mirror of
https://github.com/documize/community.git
synced 2025-07-22 22:59:43 +02:00
Refactoring of database init code
This commit is contained in:
parent
d7fea2125f
commit
3bccd6a537
7 changed files with 155 additions and 134 deletions
|
@ -75,7 +75,7 @@ func (m migrationsT) migrate(runtime *env.Runtime, tx *sqlx.Tx) error {
|
|||
return err
|
||||
}
|
||||
|
||||
err = processSQLfile(tx, runtime.DbVariant, buf)
|
||||
err = processSQLfile(tx, runtime.Storage.Type, buf)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -244,12 +244,12 @@ func Migrate(runtime *env.Runtime, ConfigTableExists bool) error {
|
|||
return migrateEnd(runtime, tx, nil, amLeader)
|
||||
}
|
||||
|
||||
func processSQLfile(tx *sqlx.Tx, v env.DbVariant, buf []byte) error {
|
||||
func processSQLfile(tx *sqlx.Tx, v env.StoreType, buf []byte) error {
|
||||
stmts := getStatements(buf)
|
||||
|
||||
for _, stmt := range stmts {
|
||||
// MariaDB has no specific JSON column type (but has JSON queries)
|
||||
if v == env.DBVariantMariaDB {
|
||||
if v == env.StoreTypeMariaDB {
|
||||
stmt = strings.Replace(stmt, "` JSON", "` TEXT", -1)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue