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