CreateHouseAdsTable::up()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
cc 1
eloc 17
c 2
b 0
f 0
nc 1
nop 0
dl 0
loc 22
rs 9.7
1
<?php
2
3
use Illuminate\Database\Schema\Blueprint;
4
use Illuminate\Database\Migrations\Migration;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateHouseAdsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('house_ads', function(Blueprint $table) {
17
            $table->id();
18
19
            $table->integer('game_id')->unsigned();
20
            $table->string('media_portrait', 128)->nullable();
21
            $table->string('media_landscape', 128)->nullable();
22
            $table->boolean('open_url')->default(true);
23
            $table->string('url_ios', 256)->nullable();
24
            $table->string('url_android', 256)->nullable();
25
            $table->tinyInteger('repeat_count')->unsigned()->default('1');
26
            $table->tinyInteger('priority')->unsigned()->default('1');
27
            $table->date('start_at');
28
            $table->date('end_at');
29
            $table->mediumInteger('shown_count')->unsigned()->default('0');
30
            $table->mediumInteger('confirmed_count')->unsigned()->default('0');
31
            $table->mediumInteger('cancelled_count')->unsigned()->default('0');
32
33
            $table->timestamps();
34
35
            $table->foreign('game_id')->references('id')->on('games')->onDelete('cascade');
36
        });
37
    }
38
39
    /**
40
     * Reverse the migrations.
41
     *
42
     * @return void
43
     */
44
    public function down()
45
    {
46
        Schema::dropIfExists('house_ads');
47
    }
48
}
49