Store outbound group sessions in database
This commit is contained in:
26
database/upgrades/2020-05-12-outbound-group-session-store.go
Normal file
26
database/upgrades/2020-05-12-outbound-group-session-store.go
Normal file
@ -0,0 +1,26 @@
|
||||
package upgrades
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
)
|
||||
|
||||
func init() {
|
||||
upgrades[14] = upgrade{"Add outbound group sessions to database", func(tx *sql.Tx, ctx context) error {
|
||||
// TODO use DATETIME instead of timestamp and BLOB instead of bytea for sqlite
|
||||
_, err := tx.Exec(`CREATE TABLE crypto_megolm_outbound_session (
|
||||
room_id VARCHAR(255) PRIMARY KEY,
|
||||
session_id CHAR(43) NOT NULL UNIQUE,
|
||||
session bytea NOT NULL,
|
||||
shared BOOLEAN NOT NULL,
|
||||
max_messages INTEGER NOT NULL,
|
||||
message_count INTEGER NOT NULL,
|
||||
max_age BIGINT NOT NULL,
|
||||
created_at timestamp NOT NULL,
|
||||
last_used timestamp NOT NULL
|
||||
)`)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}}
|
||||
}
|
@ -28,7 +28,7 @@ type upgrade struct {
|
||||
fn upgradeFunc
|
||||
}
|
||||
|
||||
const NumberOfUpgrades = 14
|
||||
const NumberOfUpgrades = 15
|
||||
|
||||
var upgrades [NumberOfUpgrades]upgrade
|
||||
|
||||
|
Reference in New Issue
Block a user