blob: 2ab1a42531a4cb47798667bbbf35696f755972e9 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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');
}
}
|