2020-05-12-outbound-group-session-store.go 743 B

1234567891011121314151617181920212223242526
  1. package upgrades
  2. import (
  3. "database/sql"
  4. )
  5. func init() {
  6. upgrades[14] = upgrade{"Add outbound group sessions to database", func(tx *sql.Tx, ctx context) error {
  7. // TODO use DATETIME instead of timestamp and BLOB instead of bytea for sqlite
  8. _, err := tx.Exec(`CREATE TABLE crypto_megolm_outbound_session (
  9. room_id VARCHAR(255) PRIMARY KEY,
  10. session_id CHAR(43) NOT NULL UNIQUE,
  11. session bytea NOT NULL,
  12. shared BOOLEAN NOT NULL,
  13. max_messages INTEGER NOT NULL,
  14. message_count INTEGER NOT NULL,
  15. max_age BIGINT NOT NULL,
  16. created_at timestamp NOT NULL,
  17. last_used timestamp NOT NULL
  18. )`)
  19. if err != nil {
  20. return err
  21. }
  22. return nil
  23. }}
  24. }