37 lines
997 B
PHP
37 lines
997 B
PHP
<?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()
|
|
{
|
|
if (Schema::hasTable('zoomyboy_event_participants')) {
|
|
Schema::table('zoomyboy_event_participants', function (Blueprint $table) {
|
|
$table->dropForeign(['event_id']);
|
|
$table->dropColumn('event_id');
|
|
});
|
|
}
|
|
|
|
Schema::dropIfExists('zoomyboy_event_events');
|
|
}
|
|
}
|