| 2 |
lars |
1 |
<?phP
|
|
|
2 |
|
|
|
3 |
use Illuminate\Database\Migrations\Migration;
|
|
|
4 |
use Illuminate\Database\Schema\Blueprint;
|
|
|
5 |
use Illuminate\Support\Facades\Schema;
|
|
|
6 |
|
|
|
7 |
return new class extends Migration
|
|
|
8 |
{
|
|
|
9 |
/**
|
|
|
10 |
* The database connection that should be used by the migration.
|
|
|
11 |
*
|
|
|
12 |
* @var string
|
|
|
13 |
*/
|
|
|
14 |
protected $connection = 'order';
|
|
|
15 |
|
|
|
16 |
/**
|
|
|
17 |
* Run the migrations.
|
|
|
18 |
*
|
|
|
19 |
* @return void
|
|
|
20 |
*/
|
|
|
21 |
public function up(): void
|
|
|
22 |
{
|
|
|
23 |
if ( !Schema::hasTable( 'orders' ) )
|
|
|
24 |
{
|
|
|
25 |
Schema::create( 'orders', function ( Blueprint $table )
|
|
|
26 |
{
|
|
|
27 |
$table->id();
|
|
|
28 |
$table->foreignId( 'shop_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDelete();
|
|
|
29 |
$table->foreignId( 'user_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDeLete();
|
|
|
30 |
$table->foreignId( 'order_type_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDeLete();
|
|
|
31 |
$table->foreignId( 'shipping_group_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDeLete();
|
|
|
32 |
$table->foreignId( 'payment_method_id' )->nullable()->constrained()->cascadeOnUpdate()->nullOnDeLete();
|
|
|
33 |
$table->unsignedBigInteger( 'bill_addr_id' )->nullable()->index();
|
|
|
34 |
$table->unsignedBigInteger( 'ship_addr_id' )->nullable()->index();
|
|
|
35 |
$table->foreign( 'bill_addr_id' )->references( "id" )->on( 'order_addresses' )->cascadeOnUpdate()->nullOnDelete();
|
|
|
36 |
$table->foreign( 'ship_addr_id' )->references( "id" )->on( 'order_addresses' )->cascadeOnUpdate()->nullOnDelete();
|
|
|
37 |
$table->unsignedTinyInteger( 'paid' )->default( 0 );
|
|
|
38 |
$table->dateTime( "paid_at" )->nullable();
|
|
|
39 |
$table->text( 'paid_comment' )->nullable()->default( '' );
|
|
|
40 |
$table->string( 'foreign_id' )->default( '' );
|
|
|
41 |
$table->string( 'foreign_payment_id' )->default( '' );
|
|
|
42 |
$table->string( "status" )->default( '' );
|
|
|
43 |
$table->string( "total_amount_buffer" )->default( '' );
|
|
|
44 |
$table->text( 'item_status_buffer' )->default( '' );
|
|
|
45 |
$table->text( 'invoice_status_buffer' )->default( '' );
|
|
|
46 |
$table->text( 'delivery_note_status_buffer' )->default( '' );
|
|
|
47 |
$table->unsignedTinyInteger( 'tax' )->default( '1' );
|
|
|
48 |
$table->text( 'comment' )->default( '' );
|
|
|
49 |
$table->text( 'external_comment' )->default( '' );
|
|
|
50 |
$table->text( 'note' )->default( '' );
|
|
|
51 |
$table->text( 'additional_info' )->default( '' );
|
|
|
52 |
$table->text( 'kk_info' )->default( '' );
|
|
|
53 |
$table->string( 'created_by' )->default( '' );
|
|
|
54 |
$table->string( 'updated_by' )->default( '' );
|
|
|
55 |
$table->timestamps();
|
|
|
56 |
} );
|
|
|
57 |
}
|
|
|
58 |
}
|
|
|
59 |
|
|
|
60 |
/**
|
|
|
61 |
* Reverse the migrations.
|
|
|
62 |
*
|
|
|
63 |
* @return void
|
|
|
64 |
*/
|
|
|
65 |
public function down(): void
|
|
|
66 |
{
|
|
|
67 |
Schema::dropIfExists( 'orders' );
|
|
|
68 |
}
|
|
|
69 |
};
|