[优化] 重构数据库迁移逻辑,整合遗留和Goose迁移处理

This commit is contained in:
ryan
2026-06-02 22:27:04 +08:00
parent dfd040a9de
commit 4ca6f2957b
9 changed files with 508 additions and 71 deletions
@@ -6,11 +6,14 @@ import (
)
const (
legacyDatabaseSchemaVersion = migrate.BaseDatabaseSchemaVersion
databaseSchemaVersionRowID = 1
legacyDatabaseSchemaVersion = migrate.BaseDatabaseSchemaVersion
legacyMigrationTerminalVersion = 17
databaseSchemaVersionRowID = 1
)
var currentDatabaseSchemaVersion = migrate.CurrentVersion()
// currentDatabaseSchemaVersion tracks the current physical schema validated by the
// legacy validator set. Goose owns only post-v17 migrations, and none exist yet.
var currentDatabaseSchemaVersion = legacyMigrationTerminalVersion
type DatabaseSchemaVersion struct {
ID uint `json:"id" gorm:"primaryKey"`