2022-05-10 22:28:30 +02:00
|
|
|
package upgrades
|
|
|
|
|
|
|
|
import (
|
|
|
|
"database/sql"
|
|
|
|
)
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
upgrades[42] = upgrade{"Add table of media to request from the user's phone", func(tx *sql.Tx, ctx context) error {
|
|
|
|
_, err := tx.Exec(`
|
|
|
|
CREATE TABLE media_backfill_requests (
|
|
|
|
user_mxid TEXT,
|
|
|
|
portal_jid TEXT,
|
|
|
|
portal_receiver TEXT,
|
|
|
|
event_id TEXT,
|
2022-05-12 18:32:14 +02:00
|
|
|
media_key BYTEA,
|
2022-05-10 22:28:30 +02:00
|
|
|
status INTEGER,
|
|
|
|
error TEXT,
|
|
|
|
|
|
|
|
PRIMARY KEY (user_mxid, portal_jid, portal_receiver, event_id),
|
|
|
|
FOREIGN KEY (user_mxid) REFERENCES "user"(mxid) ON DELETE CASCADE ON UPDATE CASCADE,
|
|
|
|
FOREIGN KEY (portal_jid, portal_receiver) REFERENCES portal(jid, receiver) ON DELETE CASCADE
|
|
|
|
)
|
|
|
|
`)
|
|
|
|
return err
|
|
|
|
}}
|
|
|
|
}
|