[DB] Forgejo database migrations

- Implements https://codeberg.org/forgejo/discussions/issues/32#issuecomment-918737
- Allows to add Forgejo-specific migrations that don't interfere with Gitea's migration logic. Please do note that we cannot liberally add migrations for Gitea tables, as they might do their own migrations in a future version on that table, and that could undo our migrations. Luckily,  we don't have a scenario where that's needed and thus not taken into account.

Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/795
(cherry picked from commit 8ee32978c0)
This commit is contained in:
Gusted 2023-06-03 08:41:16 +00:00 committed by Earl Warren
parent 7426c1edb4
commit c240b34f59
No known key found for this signature in database
GPG key ID: 0579CB2928A78A00
2 changed files with 143 additions and 1 deletions

View file

@ -9,6 +9,7 @@ import (
"fmt"
"os"
"code.gitea.io/gitea/models/forgejo_migrations"
"code.gitea.io/gitea/models/migrations/v1_10"
"code.gitea.io/gitea/models/migrations/v1_11"
"code.gitea.io/gitea/models/migrations/v1_12"
@ -607,5 +608,7 @@ Please try upgrading to a lower version first (suggested v1.6.4), then upgrade t
return err
}
}
return nil
// Execute Forgejo specific migrations.
return forgejo_migrations.Migrate(x)
}