Passed
Push — main ( 6c2dd7...891f68 )
by Richard
03:32
created

CreateGamePlayerTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 3 1
A up() 0 15 1
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateGamePlayerTable extends Migration
8
{
9
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        Schema::create('game_player', function(Blueprint $table) {
18
            $table->increments('id');
19
            
20
            $table->integer('game_id')->unsigned();
21
            $table->integer('player_id')->unsigned();
22
            $table->tinyInteger('channel')->unsigned()->default('0');
23
            $table->smallInteger('version')->unsigned()->default('100');
24
            $table->boolean('is_hack')->default(false);
25
            
26
            $table->timestamps();
27
28
            $table->foreign('game_id')->references('id')->on('games')->onDelete('cascade');
29
            $table->foreign('player_id')->references('id')->on('players')->onDelete('cascade');
30
        });
31
    }
32
33
    /**
34
     * Reverse the migrations.
35
     *
36
     * @return void
37
     */
38
    public function down()
39
    {
40
        Schema::dropIfExists('game_player');
41
    }
42
43
}
44