fix: tree & guide

This commit is contained in:
2026-03-24 09:21:21 +08:00
parent b74ba1a3f8
commit 42a879e961
15 changed files with 2619 additions and 601 deletions

View File

@@ -27,17 +27,26 @@ return new class extends Migration
Schema::create('guide_pages', function (Blueprint $table) {
$table->id();
$table->foreignId('guide_id')->constrained()->cascadeOnDelete();
$table->unsignedInteger('page_number')->comment('页码');
$table->string('title')->comment('页面标题');
$table->string('html_url', 500)->comment('HTML页面链接');
$table->integer('parent_id')->default(-1);
$table->unsignedInteger('sort_order')->default(0)->comment('排序');
$table->json('options')->nullable();
$table->string('branch_option', 100)->nullable();
$table->json('options')->nullable()->comment('分支选项(定义输出端口)');
$table->timestamps();
$table->index('parent_id');
$table->index(['guide_id', 'sort_order']);
$table->index('guide_id');
});
Schema::create('guide_page_edges', function (Blueprint $table) {
$table->id();
$table->foreignId('guide_id')->constrained()->cascadeOnDelete();
$table->foreignId('from_page_id')->constrained('guide_pages')->cascadeOnDelete();
$table->foreignId('to_page_id')->constrained('guide_pages')->cascadeOnDelete();
$table->string('label', 100)->nullable()->comment('选项按钮文字, null=顺序连接');
$table->unsignedInteger('sort')->default(0)->comment('选项排序');
$table->timestamps();
$table->unique(['from_page_id', 'label']);
$table->index('guide_id');
$table->index('to_page_id');
});
Schema::create('guide_station', function (Blueprint $table) {
@@ -53,6 +62,7 @@ return new class extends Migration
public function down(): void
{
Schema::dropIfExists('guide_station');
Schema::dropIfExists('guide_page_edges');
Schema::dropIfExists('guide_pages');
Schema::dropIfExists('guides');
}