schema change for #1274

This commit is contained in:
Shivaram Lingamneni 2020-10-27 14:05:59 -04:00
parent 1f6afa31d6
commit 4296ff02a4
2 changed files with 64 additions and 6 deletions

View file

@ -15,6 +15,14 @@ import (
"github.com/oragono/oragono/irc/utils"
)
const (
// produce a hardcoded version of the database schema
// XXX instead of referencing, e.g., keyAccountExists, we should write in the string literal
// (to ensure that no matter what code changes happen elsewhere, we're still producing a
// db of the hardcoded version)
importDBSchemaVersion = 18
)
type userImport struct {
Name string
Hash string
@ -66,11 +74,7 @@ func doImportDBGeneric(config *Config, dbImport databaseImport, credsType Creden
return fmt.Errorf("unsupported version of the db for import: version %d is required", requiredVersion)
}
// produce a hardcoded version of the database schema
// XXX instead of referencing, e.g., keyAccountExists, we should write in the string literal
// (to ensure that no matter what code changes happen elsewhere, we're still producing a
// db of the hardcoded version)
tx.Set(keySchemaVersion, "17", nil)
tx.Set(keySchemaVersion, strconv.Itoa(importDBSchemaVersion), nil)
tx.Set(keyCloakSecret, utils.GenerateSecretKey(), nil)
for username, userInfo := range dbImport.Users {