Test Failed
Push — master ( 414239...447ec5 )
by Julien
03:43
created

CreateChampionshipSettingsTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 47
Code Lines 31

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 47
rs 9.0303
c 0
b 0
f 0
cc 1
eloc 31
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->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
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
            $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...
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