Passed
Push — master ( 2a90e7...a622eb )
by Ron
02:27 queued 14s
created

CreateCustomersTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 15
dl 0
loc 33
rs 10
c 1
b 0
f 0
wmc 2
1
<?php
2
3
use Illuminate\Support\Facades\Schema;
4
use Illuminate\Database\Schema\Blueprint;
5
use Illuminate\Database\Migrations\Migration;
6
7
class CreateCustomersTable extends Migration
8
{
9
    /**
10
     * Run the migrations.
11
     *
12
     * @return void
13
     */
14
    public function up()
15
    {
16
        Schema::create('customers', function(Blueprint $table) {
17
            $table->increments('cust_id');
18
            $table->integer('parent_id')->nullable()->unsigned();
19
            $table->text('name');
20
            $table->text('dba_name')->nullable();
21
            $table->text('address');
22
            $table->text('city');
23
            $table->text('state');
24
            $table->integer('zip');
25
            $table->boolean('active')->default(1);
26
            $table->softDeletes();
27
            $table->timestamps();
28
            $table->foreign('parent_id')->references('cust_id')->on('customers')->onUpdate('cascade');
29
        });
30
    }
31
32
    /**
33
     * Reverse the migrations.
34
     *
35
     * @return void
36
     */
37
    public function down()
38
    {
39
        Schema::dropIfExists('customers');
40
    }
41
}
42