feat: add database config setting to drop automatically generated primary keys (#108918)
Signed-off-by: Bruno Abrantes <bruno@brunoabrantes.com>
This commit is contained in:
@@ -200,6 +200,10 @@ transaction_retries = 5
|
||||
# Set to true to add metrics and tracing for database queries.
|
||||
instrument_queries = false
|
||||
|
||||
# Set to true to delete auto-generated primary keys during migrations.
|
||||
# This is useful when databases have auto-generated primary keys enabled.
|
||||
delete_auto_gen_ids = false
|
||||
|
||||
#################################### Cache server #############################
|
||||
[remote_cache]
|
||||
# Either "redis", "memcached" or "database" default is "database"
|
||||
|
||||
@@ -197,6 +197,10 @@
|
||||
# Set to true to add metrics and tracing for database queries.
|
||||
;instrument_queries = false
|
||||
|
||||
# Set to true to delete auto-generated primary keys during migrations.
|
||||
# This is useful when databases have auto-generated primary keys enabled.
|
||||
;delete_auto_gen_ids = false
|
||||
|
||||
#################################### Cache server #############################
|
||||
[remote_cache]
|
||||
# Either "redis", "memcached" or "database" default is "database"
|
||||
|
||||
@@ -43,6 +43,7 @@ type DatabaseConfig struct {
|
||||
MigrationLock bool
|
||||
MigrationLockAttemptTimeout int
|
||||
LogQueries bool
|
||||
DeleteAutoGenIDs bool
|
||||
// SQLite only
|
||||
QueryRetries int
|
||||
// SQLite only
|
||||
@@ -123,6 +124,7 @@ func (dbCfg *DatabaseConfig) readConfig(cfg *setting.Cfg) error {
|
||||
dbCfg.TransactionRetries = sec.Key("transaction_retries").MustInt(5)
|
||||
|
||||
dbCfg.LogQueries = sec.Key("log_queries").MustBool(false)
|
||||
dbCfg.DeleteAutoGenIDs = sec.Key("delete_auto_gen_ids").MustBool(false)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user