cineflex/database/migrations/2022_11_22_000006_create_prices_table.php

37 lines
936 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('prices', function (Blueprint $table) {
$table->id('price_id');
$table->timestamps();
$table->enum('price_type', ['adult', 'child', 'senior']);
$table->decimal('price', 5, 2);
$table->foreignId('showing_id')->constrained('showings', 'showing_id');
$table->foreignId('user_id')->constrained('users', 'user_id'); // who added the price?
$table->unique(['showing_id', 'price_type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('prices');
}
};