8 lines
349 B
SQL
8 lines
349 B
SQL
-- Stonks Oracle - Add unique constraint for paper trading position upserts
|
|
-- Requirements: 8.1, 8.3
|
|
|
|
-- The paper trading adapter needs to upsert positions by (broker_account_id, ticker).
|
|
-- Add a unique constraint to support ON CONFLICT.
|
|
CREATE UNIQUE INDEX IF NOT EXISTS idx_positions_account_ticker
|
|
ON positions(broker_account_id, ticker);
|