cineflex/database/migrations/2022_11_22_000003_create_movies_table.php

40 lines
1.1 KiB
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('movies', function (Blueprint $table) {
$table->id('movie_id');
$table->timestamps();
$table->addColumn('string', 'movie_name', ['length' => 255]);
$table->addColumn('string', 'movie_description', ['length' => 1000]);
$table->addColumn('string', 'movie_image', ['length' => 255]);
$table->addColumn('integer', 'movie_length');
$table->addColumn('integer', 'movie_year');
$table->addColumn('integer', 'movie_age_limit');
$table->foreignId('genre_id')->constrained('genres', 'genre_id');
$table->unique(['movie_name']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('movies');
}
};