CreateLeaderboardsTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 31
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 12 1
A down() 0 3 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 CreateLeaderboardsTable extends Migration
8
{
9
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        Schema::create('leaderboards', function(Blueprint $table) {
18
            $table->increments('id');
19
20
            $table->integer('game_id')->unsigned();
21
            $table->tinyInteger('timescope')->unsigned()->default('0'); // 0 - all time, 1 - daily, 2 - weekly, 3 - monthly
22
            $table->boolean('sum_score')->default(false); // sum score on each report, if set to false then only highscore_rank will be available
23
24
            $table->timestamps();
25
26
            $table->foreign('game_id')->references('id')->on('games')->onDelete('cascade');
27
        });
28
    }
29
30
    /**
31
     * Reverse the migrations.
32
     *
33
     * @return void
34
     */
35
    public function down()
36
    {
37
        Schema::dropIfExists('leaderboards');
38
    }
39
40
}