Test Failed
Pull Request — master (#2)
by Julien
03:38
created

CreateChampionshipSettingsTable::up()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 46
Code Lines 30

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 46
rs 8.9411
c 0
b 0
f 0
cc 1
eloc 30
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
6
class CreateChampionshipSettingsTable extends Migration
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
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
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
52
            $table->smallInteger('enchoGoldPoint')->default(0); // 0 = none, 1 = 1/8, 2 = 1/4, 3=1/2, 4 = FINAL
0 ignored issues
show
Unused Code Comprehensibility introduced by
43% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
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