dendrite/syncapi/storage/postgres/schema.sql
PiotrKozimor 369890c5d1
Multiroom feature (#45)
* Multiroom feature

* Run multiroom visibility expiration conditionally

Remove SQLite and go 1.18 for tests matrixes

* Remove sqlite from unit tests

* Fix linter errors

* Do not build with go1.18

* Do not run upgrade tests

* Fix dendrite workflow

* Add forgotten content and timestamp fields to multiroom in sync response

* Fix syncapi multiroom unit tests

* Review adjustments in queries and naming

* Remove no longer maintained linters from golangci-lint configuration

* Document sqlc code generation
2022-10-31 12:52:27 +01:00

20 lines
610 B
SQL

CREATE SEQUENCE IF NOT EXISTS syncapi_multiroom_id;
CREATE TABLE IF NOT EXISTS syncapi_multiroom_data (
id BIGINT PRIMARY KEY DEFAULT nextval('syncapi_multiroom_id'),
user_id TEXT NOT NULL,
type TEXT NOT NULL,
data BYTEA NOT NULL,
ts TIMESTAMP NOT NULL DEFAULT current_timestamp
);
CREATE UNIQUE INDEX IF NOT EXISTS syncapi_multiroom_data_user_id_type_idx ON syncapi_multiroom_data(user_id, type);
CREATE TABLE IF NOT EXISTS syncapi_multiroom_visibility (
user_id TEXT NOT NULL,
type TEXT NOT NULL,
room_id TEXT NOT NULL,
expire_ts BIGINT NOT NULL DEFAULT 0,
PRIMARY KEY(user_id, type, room_id)
)