mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-14 09:23:51 +01:00
Replace VARCHAR(255) with TEXT in Matrix state store
This commit is contained in:
parent
5b5cbc2efa
commit
f3d6bbbc4a
2 changed files with 23 additions and 1 deletions
22
database/upgrades/2021-10-30-varchar-to-text-state-store.go
Normal file
22
database/upgrades/2021-10-30-varchar-to-text-state-store.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
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`,
|
||||
)
|
||||
}}
|
||||
}
|
|
@ -39,7 +39,7 @@ type upgrade struct {
|
|||
fn upgradeFunc
|
||||
}
|
||||
|
||||
const NumberOfUpgrades = 29
|
||||
const NumberOfUpgrades = 30
|
||||
|
||||
var upgrades [NumberOfUpgrades]upgrade
|
||||
|
||||
|
|
Loading…
Reference in a new issue