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 (
5 months ago
room_id BIGINT NOT NULL REFERENCES rooms(id) ON DELETE RESTRICT,
3 months ago
settings JSONB NOT NULL,
7 months ago
version BIGINT NOT NULL DEFAULT 0,
created_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMPTZ NOT NULL DEFAULT CURRENT_TIMESTAMP,
3 months ago
PRIMARY KEY (room_id),
CHECK (jsonb_typeof(settings) = 'object')
);
5 months ago
CREATE TRIGGER update_room_settings_updated_at
BEFORE UPDATE ON room_settings
FOR EACH ROW
EXECUTE FUNCTION update_updated_at_column();