51 lines
2.0 KiB
PHP
51 lines
2.0 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('tools', function (Blueprint $table): void {
|
||
|
|
$table->id();
|
||
|
|
$table->foreignId('category_id')->nullable()->constrained()->nullOnDelete();
|
||
|
|
$table->foreignId('source_id')->nullable()->constrained()->nullOnDelete();
|
||
|
|
$table->string('name', 160);
|
||
|
|
$table->string('slug')->unique();
|
||
|
|
$table->string('summary', 260);
|
||
|
|
$table->longText('description')->nullable();
|
||
|
|
$table->string('official_url', 2048)->nullable();
|
||
|
|
$table->string('pricing_type', 32)->default('freemium');
|
||
|
|
$table->string('platform', 64)->nullable();
|
||
|
|
$table->string('language', 64)->nullable();
|
||
|
|
$table->boolean('has_api')->default(false);
|
||
|
|
$table->string('source_level', 32)->default('unknown');
|
||
|
|
$table->timestamp('last_verified_at')->nullable();
|
||
|
|
$table->string('status', 32)->default('draft');
|
||
|
|
$table->boolean('is_stale')->default(false);
|
||
|
|
$table->text('stale_note')->nullable();
|
||
|
|
$table->foreignId('alternative_tool_id')->nullable()->constrained('tools')->nullOnDelete();
|
||
|
|
$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', 'is_stale', 'published_at']);
|
||
|
|
$table->index(['category_id', 'pricing_type']);
|
||
|
|
$table->index(['source_level', 'last_verified_at']);
|
||
|
|
$table->fullText(['name', 'summary', 'description']);
|
||
|
|
});
|
||
|
|
}
|
||
|
|
|
||
|
|
public function down(): void
|
||
|
|
{
|
||
|
|
Schema::dropIfExists('tools');
|
||
|
|
}
|
||
|
|
};
|