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