mirror of
https://github.com/tulir/mautrix-whatsapp
synced 2024-12-14 17:33:48 +01:00
backfill state: add table for tracking state
This commit is contained in:
parent
feb9f71cb5
commit
89663c2745
2 changed files with 26 additions and 1 deletions
25
database/upgrades/2022-05-16-room-backfill-state.go
Normal file
25
database/upgrades/2022-05-16-room-backfill-state.go
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
package upgrades
|
||||||
|
|
||||||
|
import (
|
||||||
|
"database/sql"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
upgrades[46] = upgrade{"Create the backfill state table", func(tx *sql.Tx, ctx context) error {
|
||||||
|
_, err := tx.Exec(`
|
||||||
|
CREATE TABLE backfill_state (
|
||||||
|
user_mxid TEXT,
|
||||||
|
portal_jid TEXT,
|
||||||
|
portal_receiver TEXT,
|
||||||
|
processing_batch BOOLEAN,
|
||||||
|
backfill_complete BOOLEAN,
|
||||||
|
first_expected_ts TIMESTAMP,
|
||||||
|
|
||||||
|
PRIMARY KEY (user_mxid, portal_jid, portal_receiver),
|
||||||
|
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
|
||||||
|
}}
|
||||||
|
}
|
|
@ -40,7 +40,7 @@ type upgrade struct {
|
||||||
fn upgradeFunc
|
fn upgradeFunc
|
||||||
}
|
}
|
||||||
|
|
||||||
const NumberOfUpgrades = 46
|
const NumberOfUpgrades = 47
|
||||||
|
|
||||||
var upgrades [NumberOfUpgrades]upgrade
|
var upgrades [NumberOfUpgrades]upgrade
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue