Rename migration, add missing update for appservices

This commit is contained in:
Till Faelligen 2022-02-10 15:49:08 +01:00
parent 5c5a216011
commit 9f7244f884

View file

@ -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
}