From ad1c06ee1819b3512e2443d5cbe06199a0ae9bad Mon Sep 17 00:00:00 2001 From: Sam Light Date: Tue, 10 Feb 2026 00:21:10 +0000 Subject: Created order tables and models --- .../2025_04_01_000000_create_orders_table.php | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 workbench/database/migrations/2025_04_01_000000_create_orders_table.php (limited to 'workbench/database/migrations') diff --git a/workbench/database/migrations/2025_04_01_000000_create_orders_table.php b/workbench/database/migrations/2025_04_01_000000_create_orders_table.php new file mode 100644 index 0000000..838349c --- /dev/null +++ b/workbench/database/migrations/2025_04_01_000000_create_orders_table.php @@ -0,0 +1,40 @@ +id(); + $table->enum('status', OrderStatus::cases()); + $table->decimal('total', total: 10, places: 2); + $table->timestamps(); + }); + + Schema::create('order_product', function (Blueprint $table) { + $table->id(); + $table->foreignId('order_id')->constrained()->cascadeOnDelete(); + $table->foreignId('product_id')->constrained()->cascadeOnDelete(); + $table->unsignedInteger('quantity'); + $table->decimal('price', total: 8, places: 2); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('order_product'); + Schema::dropIfExists('orders'); + } +}; -- cgit v1.2.3