%PDF- %PDF-
Direktori : /var/www/html/diaspora/api/database/migrations/ |
Current File : /var/www/html/diaspora/api/database/migrations/2019_08_07_175846_create_events_table.php |
<?php use Illuminate\Database\Migrations\Migration; use Illuminate\Database\Schema\Blueprint; use Illuminate\Support\Facades\Schema; class CreateEventsTable extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('events', function (Blueprint $table) { $table->bigIncrements('id'); $table->string('for'); $table->string('status') ->default(\App\Models\Event::DRAFT); $table->dateTime('when'); $table->string('video_type') ->nullable(); $table->string('video_url') ->nullable(); $table->dateTime('published_at') ->nullable(); $table->timestamps(); }); Schema::create('event_translations', function (Blueprint $table) { $table->bigIncrements('id'); $table->bigInteger('event_id') ->unsigned(); $table->string('title'); $table->string('location'); $table->string('description'); $table->string('locale') ->index(); $table->unique(['event_id', 'locale']); $table->foreign('event_id') ->references('id') ->on('events') ->onDelete('cascade'); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('event_translations'); Schema::dropIfExists('events'); } }