2023-02-12 01:25:16 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Zoomyboy\Event\Updates;
|
|
|
|
|
|
|
|
use Schema;
|
|
|
|
use Winter\Storm\Database\Schema\Blueprint;
|
|
|
|
use Winter\Storm\Database\Updates\Migration;
|
|
|
|
|
|
|
|
class CreateEventsTable extends Migration
|
|
|
|
{
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create('zoomyboy_event_events', function (Blueprint $table) {
|
|
|
|
$table->id();
|
|
|
|
$table->string('name');
|
|
|
|
$table->string('slug');
|
|
|
|
$table->timestamps();
|
|
|
|
});
|
|
|
|
|
|
|
|
Schema::table('zoomyboy_event_participants', function (Blueprint $table) {
|
|
|
|
$table->foreignId('event_id')->constrained('zoomyboy_event_events');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down()
|
|
|
|
{
|
2023-02-12 21:30:52 +01:00
|
|
|
if (Schema::hasTable('zoomyboy_event_participants')) {
|
|
|
|
Schema::table('zoomyboy_event_participants', function (Blueprint $table) {
|
|
|
|
$table->dropForeign(['event_id']);
|
|
|
|
$table->dropColumn('event_id');
|
|
|
|
});
|
|
|
|
}
|
2023-02-12 01:25:16 +01:00
|
|
|
|
2023-02-12 21:30:52 +01:00
|
|
|
Schema::dropIfExists('zoomyboy_event_events');
|
2023-02-12 01:25:16 +01:00
|
|
|
}
|
|
|
|
}
|