cineflex/database/migrations/2022_11_22_000010_create_seats_table.php

36 lines
938 B
PHP

<?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');
$table->addColumn('enum', 'seat_type', ['values' => ['standard', 'wheelchair', 'loveseat']]);
$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');
}
};