mirror of
https://github.com/drakkan/sftpgo.git
synced 2024-11-22 07:30:25 +00:00
CockroachDB: use unordered_unique_rowid for primary keys
sequential values in a primary key does not perform as well Signed-off-by: Nicola Murino <nicola.murino@gmail.com>
This commit is contained in:
parent
d7d7b0bbf0
commit
957d3a7b4d
1 changed files with 4 additions and 3 deletions
|
@ -786,10 +786,11 @@ func (p *PGSQLProvider) initializeDatabase() error {
|
|||
logger.InfoToConsole("creating initial database schema, version 28")
|
||||
providerLog(logger.LevelInfo, "creating initial database schema, version 28")
|
||||
var initialSQL string
|
||||
if config.Driver == PGSQLDataProviderName {
|
||||
initialSQL = sqlReplaceAll(pgsqlInitial + ipListsLikeIndex)
|
||||
} else {
|
||||
if config.Driver == CockroachDataProviderName {
|
||||
initialSQL = sqlReplaceAll(pgsqlInitial)
|
||||
initialSQL = strings.ReplaceAll(initialSQL, "GENERATED ALWAYS AS IDENTITY", "DEFAULT unordered_unique_rowid()")
|
||||
} else {
|
||||
initialSQL = sqlReplaceAll(pgsqlInitial + ipListsLikeIndex)
|
||||
}
|
||||
|
||||
return sqlCommonExecSQLAndUpdateDBVersion(p.dbHandle, []string{initialSQL}, 28, true)
|
||||
|
|
Loading…
Reference in a new issue