Files
4ventures-client-portal/sql/creative_pipeline_calendar_link.sql
4Ventures c2bbbfcd06 Link pipeline creatives to RRSS calendar pieces with pick-or-create UI.
Agency can choose a scheduled calendar post to prefill title, copy, pillar and date, or create/edit one in the calendar while adding it to the pipeline.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-06 18:01:11 +02:00

13 lines
545 B
SQL

-- Link pipeline creatives to RRSS calendar pieces (documents content.pieces[].id).
-- Idempotent.
alter table public.creative_pipeline
add column if not exists calendar_piece_id text;
create index if not exists creative_pipeline_calendar_piece_idx
on public.creative_pipeline (tenant_id, calendar_piece_id)
where calendar_piece_id is not null;
comment on column public.creative_pipeline.calendar_piece_id is
'Stable id of the RRSS calendar piece (documents type=calendar → pieces[].id). Agency links pipeline ↔ editorial plan.';