BookStackApp_BookStack/database/migrations/2023_07_31_104430_create_wa...

34 lines
835 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.
*/
public function up(): void
{
Schema::create('watches', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->index();
$table->integer('watchable_id');
$table->string('watchable_type', 100);
$table->tinyInteger('level', false, true)->index();
$table->timestamps();
$table->index(['watchable_id', 'watchable_type'], 'watchable_index');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('watches');
}
};