CreateRedeemCodesRewardsTable   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 15 1
A down() 0 3 1
1
<?php
2
3
use Illuminate\Database\Migrations\Migration;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Support\Facades\Schema;
6
7
class CreateRedeemCodesRewardsTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('redeem_code_rewards', function(Blueprint $table) {
17
            $table->increments('id');
18
19
            $table->integer('redeem_code_id')->unsigned()->nullable();
20
            $table->integer('event_id')->unsigned()->nullable();
21
            $table->tinyInteger('type')->unsigned()->default('1');
22
            $table->integer('amount')->unsigned()->default('1');
23
            $table->integer('item_id')->unsigned()->nullable();
24
25
            $table->timestamps();
26
27
            $table->foreign('redeem_code_id')->references('id')->on('redeem_codes')->onDelete('cascade');
28
            $table->foreign('event_id')->references('id')->on('events')->onDelete('cascade');
29
        });
30
    }
31
32
    /**
33
     * Reverse the migrations.
34
     *
35
     * @return void
36
     */
37
    public function down()
38
    {
39
        Schema::dropIfExists('redeem_code_rewards');
40
    }
41
}