From 03fc5fd0ea46632751abef37f1c8c1cd3f7767ef Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 7 Nov 2022 11:11:18 +0000 Subject: [PATCH] what is going on --- userapi/storage/sqlite3/accounts_table.go | 6 +++++- userapi/storage/sqlite3/storage.go | 18 +++++++++--------- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/userapi/storage/sqlite3/accounts_table.go b/userapi/storage/sqlite3/accounts_table.go index cfe6c98fa..755492f33 100644 --- a/userapi/storage/sqlite3/accounts_table.go +++ b/userapi/storage/sqlite3/accounts_table.go @@ -17,6 +17,7 @@ package sqlite3 import ( "context" "database/sql" + "fmt" "time" "github.com/matrix-org/gomatrixserverlib" @@ -35,7 +36,7 @@ const accountsSchema = ` CREATE TABLE IF NOT EXISTS userapi_accounts ( -- The Matrix user ID localpart for this account localpart TEXT NOT NULL PRIMARY KEY, - server_name TEXT NOT NULL, + server_name TEXT NOT NULL, -- When this account was first created, as a unix timestamp (ms resolution). created_ts BIGINT NOT NULL, -- The password hash for this account. Can be NULL if this is a passwordless account. @@ -89,6 +90,7 @@ 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{ { @@ -106,6 +108,8 @@ 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}, diff --git a/userapi/storage/sqlite3/storage.go b/userapi/storage/sqlite3/storage.go index 4a06444ff..1c6c7a8eb 100644 --- a/userapi/storage/sqlite3/storage.go +++ b/userapi/storage/sqlite3/storage.go @@ -15,8 +15,6 @@ package sqlite3 import ( - "context" - "database/sql" "fmt" "time" @@ -43,13 +41,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 }