From 3c7ecb1fb78d2650b5263c5cb33fbd6290984ea9 Mon Sep 17 00:00:00 2001 From: rinsvent Date: Sun, 17 May 2026 19:05:13 +0700 Subject: [PATCH] feat: add migrations --- .../2026_05_17_120004_create_slots_table.php | 23 ++++++++++++++++ .../2026_05_17_120022_create_holds_table.php | 27 +++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 database/migrations/2026_05_17_120004_create_slots_table.php create mode 100644 database/migrations/2026_05_17_120022_create_holds_table.php diff --git a/database/migrations/2026_05_17_120004_create_slots_table.php b/database/migrations/2026_05_17_120004_create_slots_table.php new file mode 100644 index 0000000..c027790 --- /dev/null +++ b/database/migrations/2026_05_17_120004_create_slots_table.php @@ -0,0 +1,23 @@ +id(); + $table->unsignedInteger('capacity'); + $table->unsignedInteger('remaining'); + $table->timestamps(); + }); + } + + public function down(): void + { + Schema::dropIfExists('slots'); + } +}; diff --git a/database/migrations/2026_05_17_120022_create_holds_table.php b/database/migrations/2026_05_17_120022_create_holds_table.php new file mode 100644 index 0000000..b91cafa --- /dev/null +++ b/database/migrations/2026_05_17_120022_create_holds_table.php @@ -0,0 +1,27 @@ +id(); + $table->foreignId('slot_id')->constrained()->cascadeOnDelete(); + $table->uuid('idempotency_key')->unique(); + $table->string('status', 20); + $table->timestamp('expires_at'); + $table->timestamps(); + + $table->index(['slot_id', 'status', 'expires_at']); + }); + } + + public function down(): void + { + Schema::dropIfExists('holds'); + } +};