mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-11-14 14:02:12 +01:00
20 lines
591 B
Go
20 lines
591 B
Go
|
package upgrades
|
||
|
|
||
|
import (
|
||
|
"database/sql"
|
||
|
)
|
||
|
|
||
|
func init() {
|
||
|
upgrades[6] = upgrade{"Add user-portal mapping table", func(dialect Dialect, tx *sql.Tx, db *sql.DB) error {
|
||
|
_, err := tx.Exec(`CREATE TABLE user_portal (
|
||
|
user_jid VARCHAR(255),
|
||
|
portal_jid VARCHAR(255),
|
||
|
portal_receiver VARCHAR(255),
|
||
|
PRIMARY KEY (user_jid, portal_jid, portal_receiver),
|
||
|
FOREIGN KEY (user_jid) REFERENCES "user"(jid) ON DELETE CASCADE,
|
||
|
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal(jid, receiver) ON DELETE CASCADE
|
||
|
)`)
|
||
|
return err
|
||
|
}}
|
||
|
}
|