summaryrefslogtreecommitdiffstats
path: root/routers/install/install.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-10-29 09:23:10 +0100
committerGitHub <noreply@github.com>2021-10-29 09:23:10 +0100
commite6e3b212b3ed01705ac6fb746f87df8204c8102c (patch)
tree4203cf44220fc5fcfdcb04320deae5b3adacd492 /routers/install/install.go
parent9733b60430d5abf7de6f7137129d604d78df9e74 (diff)
downloadgitea-e6e3b212b3ed01705ac6fb746f87df8204c8102c.tar.gz
gitea-e6e3b212b3ed01705ac6fb746f87df8204c8102c.zip
Run Migrate in Install rather than just SyncTables (#17475)
* Run Migrate in Install rather than just SyncTables The underlying problem in #17328 appears to be that users are re-running the install page during upgrades. The function that tests and creates the db did not intend for this and thus instead the migration scripts being run - a simple sync tables occurs. This then causes a weird partially migrated DB which causes, in this release cycle, the duplicate column in task table error. It is likely the cause of some weird partial migration errors in other cycles too. This PR simply ensures that the migration scripts are also run at this point too. Fix #17328 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'routers/install/install.go')
-rw-r--r--routers/install/install.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/routers/install/install.go b/routers/install/install.go
index 8143ad8089..1c042f9b4e 100644
--- a/routers/install/install.go
+++ b/routers/install/install.go
@@ -16,6 +16,7 @@ import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/models/db"
+ "code.gitea.io/gitea/models/migrations"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/generate"
@@ -208,7 +209,7 @@ func SubmitInstall(ctx *context.Context) {
}
// Set test engine.
- if err = db.NewTestEngine(); err != nil {
+ if err = db.NewInstallTestEngine(ctx, migrations.Migrate); err != nil {
if strings.Contains(err.Error(), `Unknown database type: sqlite3`) {
ctx.Data["Err_DbType"] = true
ctx.RenderWithErr(ctx.Tr("install.sqlite3_not_available", "https://docs.gitea.io/en-us/install-from-binary/"), tplInstall, &form)