40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
return new class extends Migration
|
|
{
|
|
public function up(): void
|
|
{
|
|
Schema::create('guides', function (Blueprint $table): void {
|
|
$table->id();
|
|
$table->foreignId('category_id')->nullable()->constrained()->nullOnDelete();
|
|
$table->string('title', 200);
|
|
$table->string('slug')->unique();
|
|
$table->string('excerpt', 320);
|
|
$table->longText('body');
|
|
$table->string('difficulty', 32)->default('beginner');
|
|
$table->string('status', 32)->default('draft');
|
|
$table->string('seo_title', 180)->nullable();
|
|
$table->string('seo_description', 320)->nullable();
|
|
$table->string('h1', 180)->nullable();
|
|
$table->string('canonical_url', 2048)->nullable();
|
|
$table->timestamp('published_at')->nullable();
|
|
$table->timestamps();
|
|
|
|
$table->index(['status', 'published_at']);
|
|
$table->index(['difficulty', 'published_at']);
|
|
$table->fullText(['title', 'excerpt', 'body']);
|
|
});
|
|
}
|
|
|
|
public function down(): void
|
|
{
|
|
Schema::dropIfExists('guides');
|
|
}
|
|
};
|