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

12345678910111213141516171819202122232425
  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. _, err := tx.Exec(`CREATE TABLE crypto_megolm_outbound_session (
  8. room_id VARCHAR(255) PRIMARY KEY,
  9. session_id CHAR(43) NOT NULL UNIQUE,
  10. session bytea NOT NULL,
  11. shared BOOLEAN NOT NULL,
  12. max_messages INTEGER NOT NULL,
  13. message_count INTEGER NOT NULL,
  14. max_age BIGINT NOT NULL,
  15. created_at timestamp NOT NULL,
  16. last_used timestamp NOT NULL
  17. )`)
  18. if err != nil {
  19. return err
  20. }
  21. return nil
  22. }}
  23. }