feat: add migrations
This commit is contained in:
parent
522bcb6a4e
commit
3c7ecb1fb7
23
database/migrations/2026_05_17_120004_create_slots_table.php
Normal file
23
database/migrations/2026_05_17_120004_create_slots_table.php
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('slots', function (Blueprint $table) {
|
||||||
|
$table->id();
|
||||||
|
$table->unsignedInteger('capacity');
|
||||||
|
$table->unsignedInteger('remaining');
|
||||||
|
$table->timestamps();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::dropIfExists('slots');
|
||||||
|
}
|
||||||
|
};
|
||||||
27
database/migrations/2026_05_17_120022_create_holds_table.php
Normal file
27
database/migrations/2026_05_17_120022_create_holds_table.php
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
return new class extends Migration
|
||||||
|
{
|
||||||
|
public function up(): void
|
||||||
|
{
|
||||||
|
Schema::create('holds', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
};
|
||||||
Loading…
Reference in New Issue
Block a user