37 lines
936 B
PHP
37 lines
936 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('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');
|
||
|
}
|
||
|
};
|