Completed
Branch master (384cd7)
by Nil
04:48
created

CreateOrdersTable::up()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 26
Code Lines 22

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 26
rs 8.8571
cc 1
eloc 22
nc 1
nop 0
1
<?php
2
3
namespace NilPortugues\Tests\App\Migrations;
4
5
use Illuminate\Database\Migrations\Migration;
6
use Illuminate\Database\Schema\Blueprint;
7
use Illuminate\Support\Facades\Schema;
8
9
class CreateOrdersTable extends Migration
10
{
11
    /**
12
     * Run the migrations.
13
     */
14
    public function up()
15
    {
16
        Schema::create('orders', function (Blueprint $table) {
17
            $table->integer('id', true);
18
19
            $table->integer('employee_id')->nullable()->index('employee_id_2');
20
            $table->integer('customer_id')->nullable()->index('customer_id_2');
21
            $table->dateTime('order_date')->nullable();
22
            $table->dateTime('shipped_date')->nullable();
23
            $table->integer('shipper_id')->nullable()->index('shipper_id_2');
24
            $table->string('ship_name', 50)->nullable();
25
            $table->text('ship_address')->nullable();
26
            $table->string('ship_city', 50)->nullable();
27
            $table->string('ship_state_province', 50)->nullable();
28
            $table->string('ship_zip_postal_code', 50)->nullable()->index('ship_zip_postal_code');
29
            $table->string('ship_country_region', 50)->nullable();
30
            $table->decimal('shipping_fee', 19, 4)->nullable()->default(0.0000);
31
            $table->decimal('taxes', 19, 4)->nullable()->default(0.0000);
32
            $table->string('payment_type', 50)->nullable();
33
            $table->dateTime('paid_date')->nullable();
34
            $table->text('notes')->nullable();
35
            $table->float('tax_rate', 10, 0)->nullable()->default(0);
36
            $table->boolean('tax_status_id')->nullable()->index('tax_status');
37
            $table->boolean('status_id')->nullable()->default(0)->index('fk_orders_orders_status1');
38
        });
39
    }
40
41
    /**
42
     * Reverse the migrations.
43
     */
44
    public function down()
45
    {
46
        if (Schema::hasTable('orders')) {
47
            Schema::drop('orders');
48
        }
49
    }
50
}
51