CreateLeaderboardTimescopesTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 14 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 CreateLeaderboardTimescopesTable extends Migration
8
{
9
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        Schema::create('leaderboard_timescopes', function(Blueprint $table) {
18
            $table->increments('id');
19
20
            $table->integer('leaderboard_id')->unsigned();
21
            $table->date('start_at');
22
            $table->date('end_at');
23
            $table->integer('previous_id')->unsigned()->nullable();
24
25
            $table->timestamps();
26
27
            $table->index(['start_at', 'end_at']);
28
            $table->foreign('leaderboard_id')->references('id')->on('leaderboards')->onDelete('cascade');
29
        });
30
    }
31
32
    /**
33
     * Reverse the migrations.
34
     *
35
     * @return void
36
     */
37
    public function down()
38
    {
39
        Schema::dropIfExists('leaderboard_timescopes');
40
    }
41
42
}