summaryrefslogtreecommitdiffstats
path: root/modules/setting
diff options
context:
space:
mode:
authorJason Song <i@wolfogre.com>2022-12-07 23:58:31 +0800
committerGitHub <noreply@github.com>2022-12-07 09:58:31 -0600
commit0a85537c79b65f3b10a4b66265a23a8de46a2e43 (patch)
tree882703646819e463b64fec8fc436b8087ad5fd1b /modules/setting
parente2fa84fddc80368c0315616870b8c75592397422 (diff)
downloadgitea-0a85537c79b65f3b10a4b66265a23a8de46a2e43.tar.gz
gitea-0a85537c79b65f3b10a4b66265a23a8de46a2e43.zip
Support disabling database auto migration (#22053)
Gitea will migrate the database model version automatically, but it should be able to be disabled and keep Gitea shutdown if the version is not matched.
Diffstat (limited to 'modules/setting')
-rw-r--r--modules/setting/database.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/modules/setting/database.go b/modules/setting/database.go
index be06c47478..5480f9dffd 100644
--- a/modules/setting/database.go
+++ b/modules/setting/database.go
@@ -49,6 +49,7 @@ var (
MaxOpenConns int
ConnMaxLifetime time.Duration
IterateBufferSize int
+ AutoMigration bool
}{
Timeout: 500,
IterateBufferSize: 50,
@@ -105,6 +106,7 @@ func InitDBConfig() {
Database.LogSQL = sec.Key("LOG_SQL").MustBool(true)
Database.DBConnectRetries = sec.Key("DB_RETRIES").MustInt(10)
Database.DBConnectBackoff = sec.Key("DB_RETRY_BACKOFF").MustDuration(3 * time.Second)
+ Database.AutoMigration = sec.Key("AUTO_MIGRATION").MustBool(true)
}
// DBConnStr returns database connection string