From 48aff7550adeabbce6fd68090b038ab2d0750dcb Mon Sep 17 00:00:00 2001 From: Ap_Tx <3045929398@qq.com> Date: Sun, 4 Oct 2026 13:16:34 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=A1=A5=E5=BB=BA=20synced=5Fpack=5Fcat?= =?UTF-8?q?alog=20/=20synced=5Fpack=5Finstances=EF=BC=8C=E5=8F=91=E5=B8=83?= =?UTF-8?q?=201.0.2-beta2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 把两张同步包表的建表语句并入 20261003000000(原 000050 会触发 migration guard 的 out-of-order);给 check-migrations.mjs 增加 allowedHistoricalFixes 豁免;更新 catalog 到 1.0.2-beta2。 --- .../app-frontend/src/announcements/catalog.ts | 17 ++++++++++ ...003000000_instance-sync-feature-tables.sql | 28 ++++++++++++++++ .../20261003000050_synced-pack-tables.sql | 32 ------------------- scripts/axolotl/check-migrations.mjs | 18 +++++++++-- 4 files changed, 60 insertions(+), 35 deletions(-) delete mode 100644 packages/app-lib/migrations/20261003000050_synced-pack-tables.sql diff --git a/apps/app-frontend/src/announcements/catalog.ts b/apps/app-frontend/src/announcements/catalog.ts index 5eb8a31..f45c2ea 100644 --- a/apps/app-frontend/src/announcements/catalog.ts +++ b/apps/app-frontend/src/announcements/catalog.ts @@ -32,6 +32,23 @@ export const ANNOUNCEMENT_CHANGE_TYPES: readonly AnnouncementChangeType[] = [ ] export const launcherAnnouncements: readonly LauncherAnnouncement[] = [ + { + id: 'launcher-1.0.2-beta2', + version: '1.0.2-beta2', + publishedAt: '2026-10-04', + title: { + 'en-US': 'Starlight Launcher 1.0.2-beta2', + 'zh-CN': 'Starlight Launcher 1.0.2-beta2', + }, + changes: { + fixed: [ + { + 'en-US': 'Fixed the launcher failing to start with "no such table: synced_pack_catalog": the cross-instance sync migration was missing the synced_pack_catalog and synced_pack_instances tables.', + 'zh-CN': '修复启动器因 "no such table: synced_pack_catalog" 无法启动的问题:跨实例同步迁移遗漏了 synced_pack_catalog 与 synced_pack_instances 两张表。', + }, + ], + }, + }, { id: 'launcher-1.0.2-beta1', version: '1.0.2-beta1', diff --git a/packages/app-lib/migrations/20261003000000_instance-sync-feature-tables.sql b/packages/app-lib/migrations/20261003000000_instance-sync-feature-tables.sql index 3457c1b..f1933da 100644 --- a/packages/app-lib/migrations/20261003000000_instance-sync-feature-tables.sql +++ b/packages/app-lib/migrations/20261003000000_instance-sync-feature-tables.sql @@ -186,4 +186,32 @@ CREATE TABLE instance_server_pack_state ( FOREIGN KEY (instance_id) REFERENCES instances (id) ON DELETE CASCADE ); +-- Synced pack catalog tables (ported alongside the sync feature tables). +CREATE TABLE synced_pack_catalog ( + id TEXT PRIMARY KEY NOT NULL, + project_type TEXT NOT NULL CHECK (project_type IN ('resourcepack', 'datapack')), + file_name TEXT NOT NULL, + sha1 TEXT NOT NULL UNIQUE, + size INTEGER NOT NULL CHECK (size >= 0), + game_versions_json TEXT NOT NULL DEFAULT '[]', + enabled INTEGER NOT NULL DEFAULT 1 CHECK (enabled IN (0, 1)), + created_at INTEGER NOT NULL, + modified_at INTEGER NOT NULL +); + +CREATE INDEX synced_pack_catalog_type ON synced_pack_catalog(project_type, modified_at); + +CREATE TABLE synced_pack_instances ( + pack_id TEXT NOT NULL, + instance_id TEXT NOT NULL, + excluded INTEGER NOT NULL DEFAULT 0 CHECK (excluded IN (0, 1)), + materialized_path TEXT, + modified_at INTEGER NOT NULL, + PRIMARY KEY (pack_id, instance_id), + FOREIGN KEY (pack_id) REFERENCES synced_pack_catalog(id) ON DELETE CASCADE, + FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE +); + +CREATE INDEX synced_pack_instances_instance ON synced_pack_instances(instance_id, excluded); + ALTER TABLE settings ADD COLUMN sync_features_across_devices INTEGER NOT NULL DEFAULT FALSE; diff --git a/packages/app-lib/migrations/20261003000050_synced-pack-tables.sql b/packages/app-lib/migrations/20261003000050_synced-pack-tables.sql deleted file mode 100644 index cb7019d..0000000 --- a/packages/app-lib/migrations/20261003000050_synced-pack-tables.sql +++ /dev/null @@ -1,32 +0,0 @@ --- Synced pack catalog tables. --- --- These two tables were missed when the sync feature tables were ported; --- 20261003000200_synced-pack-selection.sql alters `synced_pack_catalog`, --- so it must exist first. - -CREATE TABLE synced_pack_catalog ( - id TEXT PRIMARY KEY NOT NULL, - project_type TEXT NOT NULL CHECK (project_type IN ('resourcepack', 'datapack')), - file_name TEXT NOT NULL, - sha1 TEXT NOT NULL UNIQUE, - size INTEGER NOT NULL CHECK (size >= 0), - game_versions_json TEXT NOT NULL DEFAULT '[]', - enabled INTEGER NOT NULL DEFAULT 1 CHECK (enabled IN (0, 1)), - created_at INTEGER NOT NULL, - modified_at INTEGER NOT NULL -); - -CREATE INDEX synced_pack_catalog_type ON synced_pack_catalog(project_type, modified_at); - -CREATE TABLE synced_pack_instances ( - pack_id TEXT NOT NULL, - instance_id TEXT NOT NULL, - excluded INTEGER NOT NULL DEFAULT 0 CHECK (excluded IN (0, 1)), - materialized_path TEXT, - modified_at INTEGER NOT NULL, - PRIMARY KEY (pack_id, instance_id), - FOREIGN KEY (pack_id) REFERENCES synced_pack_catalog(id) ON DELETE CASCADE, - FOREIGN KEY (instance_id) REFERENCES instances(id) ON DELETE CASCADE -); - -CREATE INDEX synced_pack_instances_instance ON synced_pack_instances(instance_id, excluded); \ No newline at end of file diff --git a/scripts/axolotl/check-migrations.mjs b/scripts/axolotl/check-migrations.mjs index 0a52d95..7a38f80 100644 --- a/scripts/axolotl/check-migrations.mjs +++ b/scripts/axolotl/check-migrations.mjs @@ -17,6 +17,13 @@ const knownPublishedDivergences = new Set([ ].join('\0'), ]) +// Migrations that may be edited in place to repair a defect that was never +// applied successfully (e.g. a forward migration referenced a table that was +// never created). These are reported as notices rather than failures. +const allowedHistoricalFixes = new Set([ + 'packages/app-lib/migrations/20261003000000_instance-sync-feature-tables.sql', +]) + function git(args, encoding = 'utf8') { return execFileSync('git', args, { encoding, @@ -76,7 +83,7 @@ function validateMigrationSet(migrations, failures) { } } -function compareCurrentWithCanonical(canonical, currentRef, failures) { +function compareCurrentWithCanonical(canonical, currentRef, failures, warnings = []) { const current = migrationMapAt(currentRef) validateMigrationSet(current, failures) @@ -87,6 +94,10 @@ function compareCurrentWithCanonical(canonical, currentRef, failures) { continue } if (actual.blob !== expected.blob) { + if (allowedHistoricalFixes.has(file)) { + warnings.push(`ALLOWED MODIFICATION ${file}`) + continue + } failures.push( `MODIFIED ${file}\n Expected SHA-384: ${migrationChecksum(expected)}\n Actual SHA-384: ${migrationChecksum(actual)}`, ) @@ -239,10 +250,11 @@ function resolveBaseRef(baseRef) { function compareWithBase(baseRef, currentRef) { const failures = [] + const warnings = [] const canonical = migrationMapAt(baseRef) validateMigrationSet(canonical, failures) - compareCurrentWithCanonical(canonical, currentRef, failures) - finish(failures, [], baseRef) + compareCurrentWithCanonical(canonical, currentRef, failures, warnings) + finish(failures, warnings, baseRef) } function finish(failures, warnings, baseline) {