Files
TradarrV2/backend/internal/database/migrations/000018_cnbc_business.up.sql
Blomios 64a7124889 feat(sources): replace WatcherGuru with CNBC Business
Add the CNBC Business RSS source, switch supported-source wiring and reporting, and migrate existing WatcherGuru rows to disabled historical status without rewriting references.

Refs #23

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

17 lines
909 B
SQL

-- Atomic even when executed as a standalone statement. Preserve retired source
-- IDs, source keys, caps and all referencing history; never repurpose a row.
DO $migration$
BEGIN
LOCK TABLE sources IN ACCESS EXCLUSIVE MODE;
ALTER TABLE sources DROP CONSTRAINT sources_type_check;
ALTER TABLE sources ADD CONSTRAINT sources_type_check
CHECK (type IN ('bloomberg','stocktwits','reuters','watcherguru','cnbc_business'));
ALTER TABLE sources DROP CONSTRAINT sources_source_key_check;
ALTER TABLE sources ADD CONSTRAINT sources_source_key_check
CHECK (source_key IN ('yahoo_finance','bloomberg','watcher_guru','cnbc_business'));
UPDATE sources SET enabled=false WHERE source_key='watcher_guru';
INSERT INTO sources(id,name,type,enabled,article_limit,source_key)
VALUES(gen_random_uuid(),'CNBC Business','cnbc_business',true,20,'cnbc_business');
END
$migration$;