Tweak migrations
This commit is contained in:
parent
ea3517d94e
commit
32127f4f1c
|
@ -15,6 +15,8 @@
|
||||||
package postgres
|
package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -43,15 +45,13 @@ func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions,
|
||||||
Up: deltas.UpRenameTables,
|
Up: deltas.UpRenameTables,
|
||||||
Down: deltas.DownRenameTables,
|
Down: deltas.DownRenameTables,
|
||||||
})
|
})
|
||||||
/*
|
m.AddMigrations(sqlutil.Migration{
|
||||||
m.AddMigrations(sqlutil.Migration{
|
Version: "userapi: server names",
|
||||||
Version: "userapi: server names",
|
Up: func(ctx context.Context, txn *sql.Tx) error {
|
||||||
Up: func(ctx context.Context, txn *sql.Tx) error {
|
return deltas.UpServerNames(ctx, txn, serverName)
|
||||||
return deltas.UpServerNames(ctx, txn, serverName)
|
},
|
||||||
},
|
Down: deltas.DownServerNames,
|
||||||
Down: deltas.DownServerNames,
|
})
|
||||||
})
|
|
||||||
*/
|
|
||||||
if err = m.Up(base.Context()); err != nil {
|
if err = m.Up(base.Context()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -105,12 +105,6 @@ func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions,
|
||||||
return nil, fmt.Errorf("NewPostgresStatsTable: %w", err)
|
return nil, fmt.Errorf("NewPostgresStatsTable: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
m = sqlutil.NewMigrator(db)
|
|
||||||
|
|
||||||
if err = m.Up(base.Context()); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &shared.Database{
|
return &shared.Database{
|
||||||
AccountDatas: accountDataTable,
|
AccountDatas: accountDataTable,
|
||||||
Accounts: accountsTable,
|
Accounts: accountsTable,
|
||||||
|
|
|
@ -15,6 +15,8 @@
|
||||||
package sqlite3
|
package sqlite3
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
"database/sql"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -41,15 +43,13 @@ func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions,
|
||||||
Up: deltas.UpRenameTables,
|
Up: deltas.UpRenameTables,
|
||||||
Down: deltas.DownRenameTables,
|
Down: deltas.DownRenameTables,
|
||||||
})
|
})
|
||||||
/*
|
m.AddMigrations(sqlutil.Migration{
|
||||||
m.AddMigrations(sqlutil.Migration{
|
Version: "userapi: server names",
|
||||||
Version: "userapi: server names",
|
Up: func(ctx context.Context, txn *sql.Tx) error {
|
||||||
Up: func(ctx context.Context, txn *sql.Tx) error {
|
return deltas.UpServerNames(ctx, txn, serverName)
|
||||||
return deltas.UpServerNames(ctx, txn, serverName)
|
},
|
||||||
},
|
Down: deltas.DownServerNames,
|
||||||
Down: deltas.DownServerNames,
|
})
|
||||||
})
|
|
||||||
*/
|
|
||||||
if err = m.Up(base.Context()); err != nil {
|
if err = m.Up(base.Context()); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -103,12 +103,6 @@ func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions,
|
||||||
return nil, fmt.Errorf("NewSQLiteStatsTable: %w", err)
|
return nil, fmt.Errorf("NewSQLiteStatsTable: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
m = sqlutil.NewMigrator(db)
|
|
||||||
|
|
||||||
if err = m.Up(base.Context()); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
return &shared.Database{
|
return &shared.Database{
|
||||||
AccountDatas: accountDataTable,
|
AccountDatas: accountDataTable,
|
||||||
Accounts: accountsTable,
|
Accounts: accountsTable,
|
||||||
|
|
Loading…
Reference in a new issue