clrghouz/database/migrations/2019_04_16_105256_create_flag_node.php
2019-04-26 14:30:00 +10:00

40 lines
822 B
PHP

<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFlagNode extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('flag_node');
Schema::create('flag_node', function (Blueprint $table) {
$table->integer('flag_id');
$table->integer('node_id');
$table->string('arguments')->nullable();
$table->index('node_id');
$table->index('flag_id');
$table->unique(['node_id','flag_id']);
$table->foreign('node_id')->references('id')->on('nodes');
$table->foreign('flag_id')->references('id')->on('flags');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('flag_node');
}
}