You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
synctv/migrations/20260426036_create_room_mem...

12 lines
477 B
MySQL

CREATE TABLE IF NOT EXISTS room_member_versions (
room_id BIGINT NOT NULL REFERENCES rooms(id) ON DELETE CASCADE,
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
version BIGINT NOT NULL DEFAULT 0,
is_member BOOLEAN NOT NULL DEFAULT FALSE,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (room_id, user_id)
);
CREATE INDEX IF NOT EXISTS idx_room_member_versions_user
ON room_member_versions(user_id, room_id);