-- Per-user preferences for sag list filters (e.g. default type selections)

CREATE TABLE IF NOT EXISTS user_sag_list_preferences (
    user_id INTEGER PRIMARY KEY REFERENCES users(user_id) ON DELETE CASCADE,
    type_filters JSONB NOT NULL DEFAULT '[]'::jsonb,
    updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
);

CREATE INDEX IF NOT EXISTS idx_user_sag_list_preferences_updated_at
    ON user_sag_list_preferences(updated_at DESC);
