Clean up some logging

This commit is contained in:
Neil Alexander 2022-11-07 12:07:30 +00:00
parent 03fc5fd0ea
commit 2e74be1bf2
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944
3 changed files with 9 additions and 16 deletions

View file

@ -15,8 +15,6 @@
package postgres
import (
"context"
"database/sql"
"fmt"
"time"
@ -45,13 +43,15 @@ func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions,
Up: deltas.UpRenameTables,
Down: deltas.DownRenameTables,
})
m.AddMigrations(sqlutil.Migration{
Version: "userapi: server names",
Up: func(ctx context.Context, txn *sql.Tx) error {
return deltas.UpServerNames(ctx, txn, serverName)
},
Down: deltas.DownServerNames,
})
/*
m.AddMigrations(sqlutil.Migration{
Version: "userapi: server names",
Up: func(ctx context.Context, txn *sql.Tx) error {
return deltas.UpServerNames(ctx, txn, serverName)
},
Down: deltas.DownServerNames,
})
*/
if err = m.Up(base.Context()); err != nil {
return nil, err
}

View file

@ -17,7 +17,6 @@ package sqlite3
import (
"context"
"database/sql"
"fmt"
"time"
"github.com/matrix-org/gomatrixserverlib"
@ -90,7 +89,6 @@ func NewSQLiteAccountsTable(db *sql.DB, serverName gomatrixserverlib.ServerName)
if err != nil {
return nil, err
}
fmt.Println("TABLE CREATED")
m := sqlutil.NewMigrator(db)
m.AddMigrations([]sqlutil.Migration{
{
@ -108,8 +106,6 @@ func NewSQLiteAccountsTable(db *sql.DB, serverName gomatrixserverlib.ServerName)
if err != nil {
return nil, err
}
fmt.Println("MIGRATIONS RUN")
defer fmt.Println("STATEMENTS PREPARED")
return s, sqlutil.StatementList{
{&s.insertAccountStmt, insertAccountSQL},
{&s.updatePasswordStmt, updatePasswordSQL},

View file

@ -33,10 +33,7 @@ func UpServerNames(ctx context.Context, tx *sql.Tx, serverName gomatrixserverlib
)
var c int
if err := tx.QueryRowContext(ctx, q).Scan(&c); err != nil || c == 0 {
fmt.Println("Error:", err)
continue
} else {
fmt.Println("HAPPY DAYS!", table)
}
q = fmt.Sprintf(
"ALTER TABLE %s ADD COLUMN IF NOT EXISTS server_name TEXT NOT NULL DEFAULT '';",