Maybe fix database migration

Fixes #335
Fixes #304
This commit is contained in:
Tulir Asokan 2021-08-19 19:32:15 +03:00
parent da9fadb009
commit d52b012b37
2 changed files with 4 additions and 4 deletions

View file

@ -108,7 +108,7 @@ func Migrate(old *Database, new *Database) {
if err != nil {
panic(err)
}
err = migrateTable(old, new, "message", "chat_jid", "chat_receiver", "jid", "mxid", "sender", "content", "timestamp")
err = migrateTable(old, new, "message", "chat_jid", "chat_receiver", "jid", "mxid", "sender", "timestamp", "sent")
if err != nil {
panic(err)
}
@ -116,7 +116,7 @@ func Migrate(old *Database, new *Database) {
if err != nil {
panic(err)
}
err = migrateTable(old, new, "mx_user_profile", "room_id", "user_id", "membership")
err = migrateTable(old, new, "mx_user_profile", "room_id", "user_id", "membership", "displayname", "avatar_url")
if err != nil {
panic(err)
}
@ -144,7 +144,7 @@ func Migrate(old *Database, new *Database) {
if err != nil {
panic(err)
}
err = migrateTable(old, new, "crypto_megolm_inbound_session", "account_id", "session_id", "sender_key", "signing_key", "room_id", "session", "forwarding_chains")
err = migrateTable(old, new, "crypto_megolm_inbound_session", "account_id", "session_id", "sender_key", "signing_key", "room_id", "session", "forwarding_chains", "withheld_code", "withheld_reason")
if err != nil {
panic(err)
}

View file

@ -120,7 +120,7 @@ func (bridge *Bridge) MigrateDatabase() {
os.Exit(31)
}
newDB, err := database.New(bridge.Config.AppService.Database.Type, bridge.Config.AppService.Database.URI, bridge.Log)
newDB, err := database.New(bridge.Config.AppService.Database.Type, bridge.Config.AppService.Database.URI, log.DefaultLogger)
if err != nil {
fmt.Println("Failed to open new database:", err)
os.Exit(32)