mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 23:48:27 +00:00
Bit of output
This commit is contained in:
parent
9048315ffe
commit
2f41a4d2bf
1 changed files with 5 additions and 4 deletions
|
@ -17,6 +17,7 @@ package postgres
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
// Import the postgres database driver.
|
// Import the postgres database driver.
|
||||||
_ "github.com/lib/pq"
|
_ "github.com/lib/pq"
|
||||||
|
@ -39,23 +40,23 @@ func Open(dbProperties *config.DatabaseOptions, cache caching.RoomServerCaches)
|
||||||
var db *sql.DB
|
var db *sql.DB
|
||||||
var err error
|
var err error
|
||||||
if db, err = sqlutil.Open(dbProperties); err != nil {
|
if db, err = sqlutil.Open(dbProperties); err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("sqlutil.Open: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create tables before executing migrations so we don't fail if the table is missing,
|
// Create tables before executing migrations so we don't fail if the table is missing,
|
||||||
// and THEN prepare statements so we don't fail due to referencing new columns
|
// and THEN prepare statements so we don't fail due to referencing new columns
|
||||||
ms := membershipStatements{}
|
ms := membershipStatements{}
|
||||||
if err := ms.execSchema(db); err != nil {
|
if err := ms.execSchema(db); err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("ms.execSchema: %w", err)
|
||||||
}
|
}
|
||||||
m := sqlutil.NewMigrations()
|
m := sqlutil.NewMigrations()
|
||||||
deltas.LoadAddForgottenColumn(m)
|
deltas.LoadAddForgottenColumn(m)
|
||||||
deltas.LoadStateBlocksRefactor(m)
|
deltas.LoadStateBlocksRefactor(m)
|
||||||
if err := m.RunDeltas(db, dbProperties); err != nil {
|
if err := m.RunDeltas(db, dbProperties); err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("m.RunDeltas: %w", err)
|
||||||
}
|
}
|
||||||
if err := d.prepare(db, cache); err != nil {
|
if err := d.prepare(db, cache); err != nil {
|
||||||
return nil, err
|
return nil, fmt.Errorf("d.prepare: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return &d, nil
|
return &d, nil
|
||||||
|
|
Loading…
Reference in a new issue