aboutsummaryrefslogtreecommitdiff
path: root/database/migrations/2016_09_05_215803_create_root_kinds.php
diff options
context:
space:
mode:
Diffstat (limited to 'database/migrations/2016_09_05_215803_create_root_kinds.php')
-rw-r--r--database/migrations/2016_09_05_215803_create_root_kinds.php45
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');
+ }
+}