fix: 数据库初始化顺序(索引移到migrateCloudConfigs后) + deploy.sh自动检测Redis密码
This commit is contained in:
@@ -19,13 +19,6 @@ export function getDb(): Database.Database {
|
||||
db.pragma('journal_mode = WAL');
|
||||
db.pragma('foreign_keys = ON');
|
||||
|
||||
// Performance indexes (IF NOT EXISTS ensures idempotent)
|
||||
db.exec(`
|
||||
CREATE INDEX IF NOT EXISTS idx_cc_type_active ON cloud_configs(cloud_type, is_active);
|
||||
CREATE INDEX IF NOT EXISTS idx_cc_uid ON cloud_configs(cookie_uid);
|
||||
CREATE INDEX IF NOT EXISTS idx_cc_verification ON cloud_configs(verification_status);
|
||||
`);
|
||||
|
||||
runMigrations(db);
|
||||
seedAdmin(db);
|
||||
|
||||
@@ -131,6 +124,14 @@ function runMigrations(db: Database.Database): void {
|
||||
migrateSaveRecords(db);
|
||||
migrateContentCache(db);
|
||||
migrateCloudConfigs(db);
|
||||
|
||||
// Performance indexes on cloud_configs (after all columns exist)
|
||||
db.exec(`
|
||||
CREATE INDEX IF NOT EXISTS idx_cc_type_active ON cloud_configs(cloud_type, is_active);
|
||||
CREATE INDEX IF NOT EXISTS idx_cc_uid ON cloud_configs(cookie_uid);
|
||||
CREATE INDEX IF NOT EXISTS idx_cc_verification ON cloud_configs(verification_status);
|
||||
`);
|
||||
|
||||
cleanupOldSaveRecords(db);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user