0
0
Fork 1
mirror of https://github.com/tulir/mautrix-whatsapp synced 2024-12-15 01:43:49 +01:00
mautrix-whatsapp/database/upgrades/2021-10-30-varchar-to-text-state-store.go

22 lines
706 B
Go

package upgrades
import (
"database/sql"
)
func init() {
upgrades[29] = upgrade{"Replace VARCHAR(255) with TEXT in the Matrix state store", func(tx *sql.Tx, ctx context) error {
if ctx.dialect == SQLite {
// SQLite doesn't enforce varchar sizes anyway
return nil
}
return execMany(tx,
`ALTER TABLE mx_registrations ALTER COLUMN user_id TYPE TEXT`,
`ALTER TABLE mx_room_state ALTER COLUMN room_id TYPE TEXT`,
`ALTER TABLE mx_user_profile ALTER COLUMN room_id TYPE TEXT`,
`ALTER TABLE mx_user_profile ALTER COLUMN user_id TYPE TEXT`,
`ALTER TABLE mx_user_profile ALTER COLUMN membership TYPE TEXT`,
`ALTER TABLE mx_user_profile ALTER COLUMN avatar_url TYPE TEXT`,
)
}}
}