From e1aced0f0185d4bfa6ee2d2d341618c04ab3c874 Mon Sep 17 00:00:00 2001 From: HFO4 <912394456@qq.com> Date: Sat, 14 Mar 2020 18:12:26 +0800 Subject: [PATCH] Modify: check DB version before migration --- bootstrap/app.go | 2 +- models/migration.go | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/bootstrap/app.go b/bootstrap/app.go index 85545ed..a0a7fe6 100644 --- a/bootstrap/app.go +++ b/bootstrap/app.go @@ -14,7 +14,7 @@ func InitApplication() { / /___| | (_) | |_| | (_| | | | __/\ V / __/ \____/|_|\___/ \__,_|\__,_|_| \___| \_/ \___| -V` + conf.BackendVersion + ` Commit #` + conf.LastCommit + ` Pro=` + conf.IsPro + ` + V` + conf.BackendVersion + ` Commit #` + conf.LastCommit + ` Pro=` + conf.IsPro + ` ================================================ `) diff --git a/models/migration.go b/models/migration.go index c2e7fea..3fcbe91 100644 --- a/models/migration.go +++ b/models/migration.go @@ -11,8 +11,7 @@ import ( // 是否需要迁移 func needMigration() bool { var setting Setting - DB.Where("name = ?", "database_version").First(&setting) - return setting.Value != conf.RequiredDBVersion + return DB.Where("name = ?", "db_version_"+conf.RequiredDBVersion).First(&setting).Error != nil } //执行数据迁移 @@ -122,7 +121,7 @@ box-sizing: border-box; font-size: 14px; margin: 0;">重设{siteTitle}密码
亲爱的{userName}
请点击下方按钮完成密码重设。如果非你本人操作,请忽略此邮件。
重设密码
感谢您选择{siteTitle}。
`, Type: "mail_template"}, - {Name: "database_version", Value: `3.0.0-alpha1`, Type: "version"}, + {Name: "db_version_" + conf.RequiredDBVersion, Value: `installed`, Type: "version"}, {Name: "hot_share_num", Value: `10`, Type: "share"}, {Name: "gravatar_server", Value: `https://www.gravatar.com/`, Type: "avatar"}, {Name: "defaultTheme", Value: `#3f51b5`, Type: "basic"},