fix(build): allow fallback select without link_clicks and ensure unique constraint in creative_pipeline
This commit is contained in:
@@ -48,6 +48,15 @@ create unique index if not exists creative_pipeline_tenant_ref_idx
|
|||||||
on public.creative_pipeline (tenant_id, external_ref)
|
on public.creative_pipeline (tenant_id, external_ref)
|
||||||
where external_ref is not null;
|
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
|
create index if not exists creative_pipeline_tenant_month_idx
|
||||||
on public.creative_pipeline (tenant_id, month, status);
|
on public.creative_pipeline (tenant_id, month, status);
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ export async function GET(req: NextRequest) {
|
|||||||
}
|
}
|
||||||
daily = d.data || [];
|
daily = d.data || [];
|
||||||
} else {
|
} else {
|
||||||
let q = await supabase
|
let q: any = await supabase
|
||||||
.from('ad_daily')
|
.from('ad_daily')
|
||||||
.select(selectWithLc)
|
.select(selectWithLc)
|
||||||
.gte('date', since)
|
.gte('date', since)
|
||||||
|
|||||||
Reference in New Issue
Block a user