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

CreateLtTeamTable::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 6
Ratio 100 %

Importance

Changes 0
Metric Value
dl 6
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 4
nc 1
nop 0
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\Team;
7
8 View Code Duplication
class CreateLtTeamTable extends Migration
0 ignored issues
show
Duplication introduced by
This class 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...
9
{
10
    public function up()
11
    {
12
        Schema::create('team', function (Blueprint $table) {
13
            $table->increments('id');
14
            $table->integer('short_id')->unsigned()->nullable();
15
            $table->string('name');
16
            $table->integer('championship_id')->unsigned()->index(); // A checar
17
            $table->string('picture')->nullable();
18
            $table->string('entity_type')->nullable(); // Club, Assoc, Fed
19
            $table->integer('entity_id')->unsigned()->nullable()->index();
20
            $table->timestamps();
21
22
            $table->foreign('championship_id')
23
                ->references('id')
24
                ->on('championship')
25
                ->onUpdate('cascade')
26
                ->onDelete('cascade');
27
28
            $table->unique(['championship_id', 'name']);
29
        });
30
    }
31
32
    public function down()
33
    {
34
        DBHelpers::setFKCheckOff();
35
        Schema::drop('team');
36
        DBHelpers::setFKCheckOn();
37
    }
38
}
39