mautrix-go/crypto/sql_store_upgrade/06-olm-session-last-used-split.sql
Tulir Asokan d578d1a610 Move a bunch of stuff from mautrix-whatsapp
Moved parts:
* Appservice SQL state store
* Bridge crypto helper
* Database upgrade framework
* Bridge startup flow

Other changes:
* Improved database upgrade framework
  * Now primarily using static SQL files compiled with go:embed
* Moved appservice SQL state store to using membership enum on Postgres
2022-05-22 00:50:33 +03:00

6 lines
401 B
SQL

-- v6: Split last_used into last_encrypted and last_decrypted for Olm sessions
ALTER TABLE crypto_olm_session RENAME COLUMN last_used TO last_decrypted;
ALTER TABLE crypto_olm_session ADD COLUMN last_encrypted timestamp;
UPDATE crypto_olm_session SET last_encrypted=last_decrypted;
-- only: postgres (too complicated on SQLite)
ALTER TABLE crypto_olm_session ALTER COLUMN last_encrypted SET NOT NULL;