fix(build): allow fallback select without link_clicks and ensure unique constraint in creative_pipeline

This commit is contained in:
Marcos Fargas
2026-10-04 01:07:44 +02:00
parent 6566b42037
commit a3a2e4b62b
2 changed files with 10 additions and 1 deletions

View File

@@ -48,6 +48,15 @@ create unique index if not exists creative_pipeline_tenant_ref_idx
on public.creative_pipeline (tenant_id, external_ref)
where external_ref is not null;
do $$ begin
if not exists (
select 1 from pg_constraint where conname = 'creative_pipeline_tenant_ref_uniq'
) then
alter table public.creative_pipeline
add constraint creative_pipeline_tenant_ref_uniq unique (tenant_id, external_ref);
end if;
end $$;
create index if not exists creative_pipeline_tenant_month_idx
on public.creative_pipeline (tenant_id, month, status);