Files
TradarrV2/backend/internal/database/migrations/000017_company_catalog.up.sql
Blomios d65222169a feat(watchlist): add company identity catalog
Embed a pinned FinanceDatabase equity snapshot, add authenticated company search and identity-based follows, preserve legacy assets, and map selected Yahoo symbols for collection.

Refs #19

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-22 15:08:22 +01:00

14 lines
768 B
PL/PgSQL

BEGIN;
ALTER TABLE user_assets ADD COLUMN company_id TEXT NULL,
ADD COLUMN yahoo_symbol TEXT NULL,
ADD COLUMN company_exchange TEXT NULL,
ADD COLUMN company_country TEXT NULL,
ADD COLUMN company_mic TEXT NULL;
CREATE UNIQUE INDEX user_assets_company_unique ON user_assets(user_id,company_id) WHERE company_id IS NOT NULL;
-- Legacy identities remain independent of catalogue follows, even for the same FIGI.
DROP INDEX IF EXISTS user_assets_legacy_symbol_unique;
DROP INDEX IF EXISTS user_assets_figi_unique;
CREATE UNIQUE INDEX user_assets_legacy_symbol_unique ON user_assets(user_id,symbol) WHERE figi IS NULL AND company_id IS NULL;
CREATE UNIQUE INDEX user_assets_figi_unique ON user_assets(user_id,figi) WHERE figi IS NOT NULL AND company_id IS NULL;
COMMIT;