1
1
mirror of https://github.com/go-gitea/gitea synced 2025-07-22 18:28:37 +00:00

Refactor the DB migration system slightly (#32344)

Introduce "idNumber" for each migration, and clarify the difference
between the migration ID number and database version.
This commit is contained in:
wxiaoguang
2024-10-27 19:54:35 +08:00
committed by GitHub
parent 7cf611d197
commit d70af38447
4 changed files with 342 additions and 531 deletions

View File

@@ -51,7 +51,7 @@ func migrateWithSetting(x *xorm.Engine) error {
} else if current < 0 {
// execute migrations when the database isn't initialized even if AutoMigration is false
return migrations.Migrate(x)
} else if expected := migrations.ExpectedVersion(); current != expected {
} else if expected := migrations.ExpectedDBVersion(); current != expected {
log.Fatal(`"database.AUTO_MIGRATION" is disabled, but current database version %d is not equal to the expected version %d.`+
`You can set "database.AUTO_MIGRATION" to true or migrate manually by running "gitea [--config /path/to/app.ini] migrate"`, current, expected)
}