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('showings', function (Blueprint $table) {
|
|
|
|
$table->id('showing_id');
|
|
|
|
$table->timestamps();
|
|
|
|
$table->dateTime('showing_start');
|
2022-12-08 09:30:07 +01:00
|
|
|
// no showing end time, that's implied by the movie length and 10 minutes between showings
|
2022-11-23 09:32:34 +01:00
|
|
|
$table->foreignId('movie_id')->constrained('movies', 'movie_id');
|
|
|
|
$table->foreignId('room_id')->constrained('rooms', 'room_id');
|
|
|
|
$table->foreignId('user_id')->constrained('users', 'user_id');
|
|
|
|
$table->unique(['movie_id', 'room_id', 'showing_start']);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::dropIfExists('showings');
|
|
|
|
}
|
|
|
|
};
|