43 lines
1.2 KiB
PHP
43 lines
1.2 KiB
PHP
<?php namespace GermanAirlinesVa\Schooling\Updates;
|
|
|
|
use DB;
|
|
use Schema;
|
|
use October\Rain\Database\Updates\Migration;
|
|
|
|
class BuilderTableCreateExams extends Migration
|
|
{
|
|
public function up()
|
|
{
|
|
Schema::connection('germanairlinesva_schooling')->create('exams', function ($table) {
|
|
$table->engine = 'InnoDB';
|
|
$table->bigIncrements('id')->unsigned();
|
|
$table->bigInteger('member_id')->unsigned();
|
|
$table
|
|
->bigInteger('member_rank_id')
|
|
->unsigned()
|
|
->nullable();
|
|
$table
|
|
->foreign('member_rank_id')
|
|
->references('id')
|
|
->on('member_ranks');
|
|
$table
|
|
->bigInteger('typerating_id')
|
|
->unsigned()
|
|
->nullable();
|
|
$table
|
|
->foreign('typerating_id')
|
|
->references('id')
|
|
->on('typeratings');
|
|
$table->datetime('start')->default(DB::raw('NOW()'));
|
|
$table->enum('status', ['pending', 'validated', 'closed', 'open']);
|
|
});
|
|
}
|
|
|
|
public function down()
|
|
{
|
|
Schema::connection('germanairlinesva_schooling')->disableForeignKeyConstraints();
|
|
Schema::connection('germanairlinesva_schooling')->dropIfExists('exams');
|
|
Schema::connection('germanairlinesva_schooling')->enableForeignKeyConstraints();
|
|
}
|
|
}
|