From 9f7244f884ab00df83fca70838a695cf7ee8af6c Mon Sep 17 00:00:00 2001 From: Till Faelligen Date: Thu, 10 Feb 2022 15:49:08 +0100 Subject: [PATCH] Rename migration, add missing update for appservices --- ...nt_type.go => 2022021013023800_add_account_type.go} | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) rename userapi/storage/accounts/postgres/deltas/{20220210130238_add_account_type.go => 2022021013023800_add_account_type.go} (79%) diff --git a/userapi/storage/accounts/postgres/deltas/20220210130238_add_account_type.go b/userapi/storage/accounts/postgres/deltas/2022021013023800_add_account_type.go similarity index 79% rename from userapi/storage/accounts/postgres/deltas/20220210130238_add_account_type.go rename to userapi/storage/accounts/postgres/deltas/2022021013023800_add_account_type.go index bb5374896..f4da387f9 100644 --- a/userapi/storage/accounts/postgres/deltas/20220210130238_add_account_type.go +++ b/userapi/storage/accounts/postgres/deltas/2022021013023800_add_account_type.go @@ -4,15 +4,9 @@ import ( "database/sql" "fmt" - "github.com/pressly/goose" - "github.com/matrix-org/dendrite/internal/sqlutil" ) -func init() { - goose.AddMigration(UpAddAccountType, DownAddAccountType) -} - func LoadAddAccountType(m *sqlutil.Migrations) { m.AddMigration(UpAddAccountType, DownAddAccountType) } @@ -22,6 +16,10 @@ func UpAddAccountType(tx *sql.Tx) error { if err != nil { return fmt.Errorf("failed to execute upgrade: %w", err) } + _, err = tx.Exec("UPDATE account_accounts SET account_type = 4 WHERE appservice_id <> '';") + if err != nil { + return fmt.Errorf("failed to execute upgrade: %w", err) + } return nil }