This commit is contained in:
Yvan
2026-09-04 14:07:09 +08:00
parent af1e194396
commit 43db5e5450
22 changed files with 416 additions and 134 deletions
+8
View File
@@ -137,6 +137,14 @@ func (d *Data) InitializeDatabase(ctx context.Context, input *system.DatabaseCon
}
}
}()
releaseLock, err := acquireInitializationLock(ctx, candidate, database)
if err != nil {
return err
}
defer releaseLock()
if persistedDatabaseConfigured(d.runtime) {
return errors.New("数据库已初始化,无需重复初始化")
}
db := candidate.WithContext(ctx)
if err := migrateAll(db, d.catalog); err != nil {
return err