ferrero-opentext/Python-Version/database/migrations/004_add_global_master_tracking_id.sql
nickviljoen 51e915e67c Add global_master_tracking_id to link A1→A2 local assets to B1→B2 global masters
A1→A2 now looks up the opentext_id in master_assets for an M-prefixed record
from B1→B2 and stores it as global_master_tracking_id on the local asset record.
This provides traceability from local campaign assets back to their global master
without changing any existing workflow logic or DAM metadata.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-21 13:12:55 +02:00

13 lines
556 B
SQL

-- Migration 004: Add global_master_tracking_id column to master_assets
-- Purpose: Links local campaign assets (A1→A2) back to their global master (B1→B2)
-- by storing the M-prefixed tracking ID from the B1 record
-- Date: 2026-03-21
ALTER TABLE master_assets
ADD COLUMN IF NOT EXISTS global_master_tracking_id VARCHAR(6);
-- Index for lookups
CREATE INDEX IF NOT EXISTS idx_master_assets_global_master_tracking
ON master_assets(global_master_tracking_id);
\echo 'Migration 004 complete: Added global_master_tracking_id to master_assets'