Completed
Push — master ( d287d6...1f93a6 )
by Nasrul Hazim
01:54
created

CreateBanksTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A down() 0 4 1
A up() 0 19 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 CreateBanksTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     */
12
    public function up()
13
    {
14
        Schema::create('banks', function (Blueprint $table) {
15
            $table->increments('id');
16
            $table->string('name')->nullable();
17
            $table->code('swift_code');
18
            $table->code('bank_code');
19
            $table->standardTime();
20
        });
21
22
        Schema::create('bank_accounts', function (Blueprint $table) {
23
            $table->increments('id');
24
            $table->hashslug();
25
            $table->belongsTo('banks');
26
            $table->unsignedInteger('bankable_id');
27
            $table->string('bankable_type');
28
            $table->string('account_no')->nullable();
29
            $table->is('default');
30
            $table->standardTime();
31
        });
32
    }
33
34
    /**
35
     * Reverse the migrations.
36
     */
37
    public function down()
38
    {
39
        Schema::dropIfExists('bank_accounts');
40
        Schema::dropIfExists('banks');
41
    }
42
}
43