2018-07-18 00:05:37 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
2018-08-28 03:07:36 +00:00
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
2018-07-18 00:05:37 +00:00
|
|
|
|
|
|
|
class CreateUserFiltersTable extends Migration
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
Schema::create('user_filters', function (Blueprint $table) {
|
|
|
|
$table->bigIncrements('id');
|
|
|
|
$table->bigInteger('user_id')->unsigned()->index();
|
|
|
|
$table->bigInteger('filterable_id')->unsigned();
|
|
|
|
$table->string('filterable_type');
|
|
|
|
$table->string('filter_type')->default('block')->index();
|
|
|
|
$table->unique([
|
|
|
|
'user_id',
|
|
|
|
'filterable_id',
|
|
|
|
'filterable_type',
|
2018-08-28 03:07:36 +00:00
|
|
|
'filter_type',
|
2018-07-18 00:05:37 +00:00
|
|
|
], 'filter_unique');
|
|
|
|
$table->timestamps();
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
Schema::dropIfExists('user_filters');
|
|
|
|
}
|
|
|
|
}
|