cyberhybridhub/server/migrations/015_prospective_assignments_per_symbol.sql

15 lines
719 B
SQL

-- One guess assignment per user per slot pair per symbol (top-half assets).
ALTER TABLE market_history_prospective_assignments
DROP CONSTRAINT IF EXISTS market_history_prospective_as_assigned_user_id_older_slot_s_key;
ALTER TABLE market_history_prospective_assignments
DROP CONSTRAINT IF EXISTS market_history_prospective_assignments_assigned_user_id_older_slot_s_key;
ALTER TABLE market_history_prospective_assignments
DROP CONSTRAINT IF EXISTS market_history_prospective_assignments_user_slot_symbol_key;
ALTER TABLE market_history_prospective_assignments
ADD CONSTRAINT market_history_prospective_assignments_user_slot_symbol_key
UNIQUE (assigned_user_id, older_slot_start, newer_slot_start, symbol);