2021-05-16 01:29:56 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
|
2023-02-06 17:58:29 +01:00
|
|
|
return new class extends Migration
|
2021-05-16 01:29:56 +02:00
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create('favourites', function (Blueprint $table) {
|
|
|
|
$table->increments('id');
|
|
|
|
$table->integer('user_id')->index();
|
|
|
|
$table->integer('favouritable_id');
|
|
|
|
$table->string('favouritable_type', 100);
|
|
|
|
$table->timestamps();
|
|
|
|
|
|
|
|
$table->index(['favouritable_id', 'favouritable_type'], 'favouritable_index');
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::dropIfExists('favourites');
|
|
|
|
}
|
2023-02-06 17:58:29 +01:00
|
|
|
};
|