mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-06 22:43:10 -06:00
* 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
44 lines
975 B
SQL
44 lines
975 B
SQL
-- name: InsertMultiRoomData :one
|
|
INSERT INTO syncapi_multiroom_data (
|
|
user_id,
|
|
type,
|
|
data
|
|
) VALUES (
|
|
$1,
|
|
$2,
|
|
$3
|
|
) ON CONFLICT (user_id, type) DO UPDATE SET id = nextval('syncapi_multiroom_id'), data = $3, ts = current_timestamp
|
|
RETURNING id;
|
|
|
|
|
|
-- name: InsertMultiRoomVisibility :exec
|
|
INSERT INTO syncapi_multiroom_visibility (
|
|
user_id,
|
|
type,
|
|
room_id,
|
|
expire_ts
|
|
) VALUES (
|
|
$1,
|
|
$2,
|
|
$3,
|
|
$4
|
|
) ON CONFLICT (user_id, type, room_id) DO UPDATE SET expire_ts = $4;
|
|
|
|
-- name: SelectMultiRoomVisibilityRooms :many
|
|
SELECT room_id FROM syncapi_multiroom_visibility
|
|
WHERE user_id = $1
|
|
AND expire_ts > $2;
|
|
|
|
|
|
-- name: SelectMaxId :one
|
|
SELECT MAX(id) FROM syncapi_multiroom_data;
|
|
|
|
-- name: DeleteMultiRoomVisibility :exec
|
|
DELETE FROM syncapi_multiroom_visibility
|
|
WHERE user_id = $1
|
|
AND type = $2
|
|
AND room_id = $3;
|
|
|
|
-- name: DeleteMultiRoomVisibilityByExpireTS :execrows
|
|
DELETE FROM syncapi_multiroom_visibility
|
|
WHERE expire_ts <= $1; |