1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use Illuminate\Database\Migrations\Migration; |
4
|
|
|
use Illuminate\Database\Schema\Blueprint; |
5
|
|
|
|
6
|
|
|
class CreateChampionshipSettingsTable extends Migration |
|
|
|
|
7
|
|
|
{ |
8
|
|
|
/** |
9
|
|
|
* Run the migrations. |
10
|
|
|
* |
11
|
|
|
* @return void |
12
|
|
|
*/ |
13
|
|
|
public function up() |
14
|
|
|
{ |
15
|
|
|
Schema::create('championship_settings', function (Blueprint $table) { |
16
|
|
|
$table->increments('id'); |
17
|
|
|
$table->string('alias')->nullable(); |
18
|
|
|
$table->integer('championship_id')->unsigned()->unique(); |
19
|
|
|
$table->foreign('championship_id') |
20
|
|
|
->references('id') |
21
|
|
|
->onUpdate('cascade') |
22
|
|
|
->on('championship') |
23
|
|
|
->onDelete('cascade'); |
24
|
|
|
|
25
|
|
|
// Category Section |
26
|
|
|
$table->tinyInteger('treeType')->default(1); // 0 - RoundRobin; 1 - Direct Elimination; |
27
|
|
|
$table->tinyInteger('fightingAreas')->unsigned()->nullable()->default(1); |
28
|
|
|
$table->integer('limitByEntity')->unsigned()->nullable(); |
29
|
|
|
|
30
|
|
|
// Preliminary |
31
|
|
|
$table->boolean('hasPreliminary')->default(1); |
32
|
|
|
$table->boolean('preliminaryGroupSize')->default(3); |
33
|
|
|
$table->tinyInteger('preliminaryWinner')->default(1); // Number of Competitors that go to next level |
34
|
|
|
$table->text('preliminaryDuration')->nullable(); // Match Duration in preliminary heat |
35
|
|
|
|
36
|
|
|
// Team |
37
|
|
|
$table->tinyInteger('teamSize')->nullable(); // Default is null |
38
|
|
|
$table->tinyInteger('teamReserve')->nullable(); // Default is null |
39
|
|
|
|
40
|
|
|
// Seed |
41
|
|
|
$table->smallInteger('seedQuantity')->nullable(); // Competitors seeded in tree |
42
|
|
|
|
43
|
|
|
//TODO This should go in another table that is not for tree construction but for rules |
44
|
|
|
// Rules |
45
|
|
|
$table->boolean('hasEncho')->default(1); |
46
|
|
|
$table->tinyInteger('enchoQty')->default(0); |
47
|
|
|
$table->text('enchoDuration')->nullable(); |
48
|
|
|
$table->boolean('hasHantei')->default(false); |
49
|
|
|
$table->smallInteger('cost')->nullable(); // Cost of competition |
50
|
|
|
|
51
|
|
|
$table->text('fightDuration')->nullable(); // Can't apply default because text |
52
|
|
|
$table->smallInteger('hanteiLimit')->default(0); // 0 = none, 1 = 1/8, 2 = 1/4, 3=1/2, 4 = FINAL |
|
|
|
|
53
|
|
|
$table->smallInteger('enchoGoldPoint')->default(0); // 0 = none, 1 = 1/8, 2 = 1/4, 3=1/2, 4 = FINAL |
|
|
|
|
54
|
|
|
|
55
|
|
|
$table->timestamps(); |
56
|
|
|
$table->softDeletes(); |
57
|
|
|
$table->engine = 'InnoDB'; |
58
|
|
|
}); |
59
|
|
|
} |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* Reverse the migrations. |
63
|
|
|
* |
64
|
|
|
* @return void |
65
|
|
|
*/ |
66
|
|
|
public function down() |
67
|
|
|
{ |
68
|
|
|
DB::statement('SET FOREIGN_KEY_CHECKS = 0'); |
69
|
|
|
Schema::dropIfExists('championship_settings'); |
70
|
|
|
DB::statement('SET FOREIGN_KEY_CHECKS = 1'); |
71
|
|
|
} |
72
|
|
|
} |
73
|
|
|
|
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.