39 lines
1.1 KiB
PHP
39 lines
1.1 KiB
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('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');
|
|
}
|
|
};
|