Passed
Push — master ( ba125c...76adf7 )
by Faith
09:21
created

CreateAccountsTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 28
c 0
b 0
f 0
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 10 1
A down() 0 3 1
1
<?php
2
3
use FaithGen\SDK\Models\Ministry;
4
use Illuminate\Database\Migrations\Migration;
5
use Illuminate\Database\Schema\Blueprint;
6
use Illuminate\Support\Facades\Schema;
7
8
class CreateAccountsTable extends Migration
9
{
10
    /**
11
     * Run the migrations.
12
     *
13
     * @return void
14
     */
15
    public function up()
16
    {
17
        Schema::create('fg_accounts', function (Blueprint $table) {
18
            $table->string('id', 150)->primary();
19
            $table->string('ministry_id', 150)->index();
20
            $table->enum('level', Ministry::ACCOUNT_LEVELS)->default('Free');
21
            $table->dateTime('expiry_date')->default(now());
22
            $table->timestamps();
23
24
            $table->foreign('ministry_id')->references('id')->on('fg_ministries')->onDelete('cascade');
25
        });
26
    }
27
28
    /**
29
     * Reverse the migrations.
30
     *
31
     * @return void
32
     */
33
    public function down()
34
    {
35
        Schema::dropIfExists('fg_accounts');
36
    }
37
}
38