cineflex/database/migrations/2022_11_22_000010_create_seats_table.php

38 lines
1,022 B
PHP
Raw Normal View History

2022-11-23 09:32:34 +01:00
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('seats', function (Blueprint $table) {
$table->id('seat_id');
$table->timestamps();
$table->addColumn('integer', 'seat_row');
$table->addColumn('integer', 'seat_column');
2023-01-01 20:13:11 +01:00
$table->enum('seat_type', ['standard', 'wheelchair', 'loveseat', 'not_available']);
$table->foreignId('seat_linked_id')->nullable()->constrained('seats', 'seat_id');
2022-11-23 09:32:34 +01:00
$table->foreignId('room_id')->constrained('rooms', 'room_id');
$table->unique(['room_id', 'seat_row', 'seat_column']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('seats');
}
};