35 lines
841 B
PHP
35 lines
841 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('ratings', function (Blueprint $table) {
|
|
$table->id('rating_id');
|
|
$table->timestamps();
|
|
$table->decimal('rating_value', 3, 1);
|
|
$table->foreignId('movie_id')->constrained('movies', 'movie_id');
|
|
$table->foreignId('user_id')->constrained('users', 'user_id');
|
|
$table->unique(['movie_id', 'user_id']);
|
|
});
|
|
}
|
|
|
|
/**
|
|
* Reverse the migrations.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function down()
|
|
{
|
|
Schema::dropIfExists('ratings');
|
|
}
|
|
};
|