diff options
author | Camil Staps | 2016-09-06 00:23:26 +0200 |
---|---|---|
committer | Camil Staps | 2016-09-06 00:23:26 +0200 |
commit | 6f6a6abe3c9971b60aad585a198ced6c51329ef5 (patch) | |
tree | a6a5300eb572c1306c34d1f400a928eb2a68f631 /database/migrations | |
parent | Add roots (diff) |
Different root kinds instead of only strong/weak
Diffstat (limited to 'database/migrations')
-rw-r--r-- | database/migrations/2016_09_05_215803_create_root_kinds.php | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/database/migrations/2016_09_05_215803_create_root_kinds.php b/database/migrations/2016_09_05_215803_create_root_kinds.php new file mode 100644 index 0000000..2ab1a42 --- /dev/null +++ b/database/migrations/2016_09_05_215803_create_root_kinds.php @@ -0,0 +1,45 @@ +<?php + +use Illuminate\Database\Schema\Blueprint; +use Illuminate\Database\Migrations\Migration; + +class CreateRootKinds extends Migration +{ + /** + * Run the migrations. + * + * @return void + */ + public function up() + { + Schema::create('root_kinds', function (Blueprint $table) { + $table->increments('id'); + $table->boolean('strong'); + $table->string('name')->unique(); + }); + + Schema::table('roots', function (Blueprint $table) { + $table->dropColumn('strong'); + + $table->integer('root_kind_id')->unsigned()->nullable(); + $table->foreign('root_kind_id')->references('id')->on('root_kinds'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('roots', function (Blueprint $table) { + $table->dropForeign(['root_kind_id']); + $table->dropColumn('root_kind_id'); + + $table->boolean('strong')->default(1); + }); + + Schema::drop('root_kinds'); + } +} |