Files
ai-web/database/migrations/2026_02_11_100600_create_guides_table.php
jiangdong.cheng aa16c9f8c2
Some checks failed
Tests / PHP 8.2 (push) Has been cancelled
Tests / PHP 8.3 (push) Has been cancelled
Tests / PHP 8.4 (push) Has been cancelled
init
2026-02-11 17:28:36 +08:00

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');
}
};