Completed
Push — master ( 3bd578...cfd7eb )
by Abdelrahman
02:01 queued 10s
created

CreateAddressesTable   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 4

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 4
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 24 1
A down() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
use Illuminate\Support\Facades\Schema;
6
use Illuminate\Database\Schema\Blueprint;
7
use Illuminate\Database\Migrations\Migration;
8
9
class CreateAddressesTable extends Migration
10
{
11
    public function up()
12
    {
13
        Schema::create(config('rinvex.addresses.tables.addresses'), function (Blueprint $table) {
14
            // Columns
15
            $table->increments('id');
16
            $table->morphs('addressable');
17
            $table->string('given_name');
18
            $table->string('family_name');
19
            $table->string('label')->nullable();
20
            $table->string('organization')->nullable();
21
            $table->string('country_code', 2)->nullable();
22
            $table->string('street')->nullable();
23
            $table->string('state')->nullable();
24
            $table->string('city')->nullable();
25
            $table->string('postal_code')->nullable();
26
            $table->decimal('latitude', 10, 7)->nullable();
27
            $table->decimal('longitude', 10, 7)->nullable();
28
            $table->boolean('is_primary')->default(false);
29
            $table->boolean('is_billing')->default(false);
30
            $table->boolean('is_shipping')->default(false);
31
            $table->timestamps();
32
            $table->softDeletes();
33
        });
34
    }
35
36
    public function down()
37
    {
38
        Schema::dropIfExists(config('rinvex.addresses.tables.addresses'));
39
    }
40
}
41