File: D:/HostingSpaces/stafa/stafa.nl/database/migrations/2018_11_16_154518_create_components_table.php
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateComponentsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('components', function (Blueprint $table) {
$table->increments('id');
$table->unsignedInteger('component_type_id'); //Does not refer to another tables column. Does refer to one of the ComponentTypes enum constants
$table->unsignedInteger('component_area_id');
$table->unsignedInteger('sort_order');
$table->string('version');
$table->mediumText('data');
$table->timestamps();
$table->foreign('component_area_id')->references('id')->on('component_areas');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::disableForeignKeyConstraints();
Schema::dropIfExists('components');
Schema::enableForeignKeyConstraints();
}
}