wi-events/updates/create_events_table.php

34 lines
862 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()
{
Schema::dropIfExists('zoomyboy_event_events');
Schema::create('zoomyboy_event_participants', function (Blueprint $table) {
$table->dropColumn('event_id');
});
}
}