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/20260426016_create_room_set...

15 lines
531 B
MySQL

CREATE TABLE IF NOT EXISTS room_settings (
room_id BIGINT NOT NULL REFERENCES rooms(id) ON DELETE RESTRICT,
settings JSONB NOT NULL,
version BIGINT NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (room_id),
CHECK (jsonb_typeof(settings) = 'object')
);
CREATE TRIGGER update_room_settings_updated_at
BEFORE UPDATE ON room_settings
FOR EACH ROW
EXECUTE FUNCTION update_updated_at_column();