-
Notifications
You must be signed in to change notification settings - Fork 2
/
2021_10_01_090000_create_orders_table.php
38 lines (35 loc) · 1.46 KB
/
2021_10_01_090000_create_orders_table.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
use GetCandy\Base\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateOrdersTable extends Migration
{
public function up()
{
Schema::create($this->prefix.'orders', function (Blueprint $table) {
$table->bigIncrements('id');
$table->userForeignKey(nullable: true);
$table->foreignId('channel_id')->constrained($this->prefix.'channels');
$table->string('status')->index();
$table->string('reference')->nullable()->unique();
$table->string('customer_reference')->nullable();
$table->integer('sub_total')->unsigned()->index();
$table->integer('discount_total')->default(0)->unsigned()->index();
$table->integer('shipping_total')->default(0)->unsigned()->index();
$table->json('tax_breakdown');
$table->integer('tax_total')->unsigned()->index();
$table->integer('total')->unsigned()->index();
$table->text('notes')->nullable();
$table->string('currency_code', 3);
$table->string('compare_currency_code', 3)->nullable();
$table->decimal('exchange_rate', 10, 4)->default(1);
$table->dateTime('placed_at')->nullable()->index();
$table->json('meta')->nullable();
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists($this->prefix.'orders');
}
}