1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Illuminate\Database\Migrations\Migration; |
4
|
|
|
use Illuminate\Database\Schema\Blueprint; |
5
|
|
|
use Illuminate\Support\Facades\Schema; |
6
|
|
|
|
7
|
|
|
class CreateFightTable extends Migration |
|
|
|
|
8
|
|
|
{ |
9
|
|
|
/** |
10
|
|
|
* Run the migrations. |
11
|
|
|
* |
12
|
|
|
* @return void |
13
|
|
|
*/ |
14
|
|
|
public function up() |
15
|
|
|
{ |
16
|
|
|
Schema::create('fight', function (Blueprint $table) { |
|
|
|
|
17
|
|
|
$table->increments('id'); |
18
|
|
|
$table->integer('fighters_group_id')->unsigned()->index(); |
19
|
|
|
$table->foreign('fighters_group_id') |
20
|
|
|
->references('id') |
21
|
|
|
->on('fighters_groups') |
22
|
|
|
->onUpdate('cascade') |
23
|
|
|
->onDelete('cascade'); |
24
|
|
|
$table->integer('c1')->nullable()->unsigned()->index(); |
25
|
|
|
$table->integer('c2')->nullable()->unsigned()->index(); |
26
|
|
|
$table->char('point1_c1')->nullable(); |
27
|
|
|
$table->char('point2_c1')->nullable(); |
28
|
|
|
$table->char('point1_c2')->nullable(); |
29
|
|
|
$table->char('point2_c2')->nullable(); |
30
|
|
|
$table->integer('winner_id')->unsigned()->nullable(); |
31
|
|
|
|
32
|
|
|
$table->boolean('hansoku1_c1')->nullable(); |
33
|
|
|
$table->boolean('hansoku2_c1')->nullable(); |
34
|
|
|
$table->boolean('hansoku3_c1')->nullable(); |
35
|
|
|
$table->boolean('hansoku4_c1')->nullable(); |
36
|
|
|
$table->boolean('hansoku1_c2')->nullable(); |
37
|
|
|
$table->boolean('hansoku2_c2')->nullable(); |
38
|
|
|
$table->boolean('hansoku3_c2')->nullable(); |
39
|
|
|
$table->boolean('hansoku4_c2')->nullable(); |
40
|
|
|
|
41
|
|
|
$table->tinyInteger('area'); |
42
|
|
|
$table->tinyInteger('order'); |
43
|
|
|
$table->timestamps(); |
44
|
|
|
$table->engine = 'InnoDB'; |
45
|
|
|
}); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Reverse the migrations. |
50
|
|
|
* |
51
|
|
|
* @return void |
52
|
|
|
*/ |
53
|
|
|
public function down() |
54
|
|
|
{ |
55
|
|
|
DB::statement('SET FOREIGN_KEY_CHECKS = 0'); |
56
|
|
|
Schema::dropIfExists('fight'); |
57
|
|
|
DB::statement('SET FOREIGN_KEY_CHECKS = 1'); |
58
|
|
|
} |
59
|
|
|
} |
60
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.