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 package postgres
import ( import (
"context"
"database/sql"
"fmt" "fmt"
"time" "time"
@ -45,6 +43,7 @@ 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 {
@ -52,6 +51,7 @@ func NewDatabase(base *base.BaseDendrite, dbProperties *config.DatabaseOptions,
}, },
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
} }

View file

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

View file

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