Completed
Push — master ( 2f5a59...1aef96 )
by Julien
10:27 queued 03:33
created

CreateLtFightersGroupTable::up()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 21
Code Lines 16

Duplication

Lines 21
Ratio 100 %

Importance

Changes 0
Metric Value
dl 21
loc 21
rs 9.3142
c 0
b 0
f 0
cc 1
eloc 16
nc 1
nop 0
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
use Kalnoy\Nestedset\NestedSet;
7
use Xoco70\LaravelTournaments\DBHelpers;
8
9
class CreateLtFightersGroupTable extends Migration
10
{
11
    /**
12
     * Run the migrations.
13
     *
14
     * @return void
15
     */
16 View Code Duplication
    public function up()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
17
    {
18
        Schema::create('fighters_groups', function (Blueprint $table) {
19
            $table->increments('id');
20
            $table->tinyInteger('short_id')->unsigned()->nullable();
21
            $table->integer('championship_id')->unsigned()->index();
22
            $table->tinyInteger('round')->default(0); // Eliminitory, 1/8, 1/4, etc.
23
            $table->tinyInteger('area');
24
            $table->tinyInteger('order');
25
            NestedSet::columns($table);
26
27
            $table->timestamps();
28
            $table->engine = 'InnoDB';
29
30
            $table->foreign('championship_id')
31
                ->references('id')
32
                ->onUpdate('cascade')
33
                ->on('championship')
34
                ->onDelete('cascade');
35
        });
36
    }
37
38
    /**
39
     * Reverse the migrations.
40
     *
41
     * @return void
42
     */
43
    public function down()
44
    {
45
        DBHelpers::setFKCheckOff();
46
        Schema::dropIfExists('fighters_groups');
47
        DBHelpers::setFKCheckOn();
48
    }
49
}
50