Agency validates first then client; Meta copy is 5+5+1 with on-image vs feed layers, emojis on feed, and partial v2 by image/hook/support/copy. Co-authored-by: Cursor <cursoragent@cursor.com>
58 lines
2.5 KiB
SQL
58 lines
2.5 KiB
SQL
-- Unifica estados de aprobación Ads (creatives) + RRSS (creative_pipeline).
|
|
-- Flujo: borrador → revision_agencia → pendiente_aprobacion → aprobada|rechazada → publicada
|
|
-- Idempotente.
|
|
|
|
-- ─── creative_pipeline (RRSS) ───────────────────────────────────────────────
|
|
|
|
alter table public.creative_pipeline drop constraint if exists creative_pipeline_status_check;
|
|
|
|
update public.creative_pipeline set status = 'borrador' where status in ('propuesta', 'en_diseno');
|
|
-- revision_interna se usaba como "el cliente decide" → pendiente_aprobacion
|
|
update public.creative_pipeline set status = 'pendiente_aprobacion' where status = 'revision_interna';
|
|
update public.creative_pipeline set status = 'aprobada' where status = 'aprobado';
|
|
update public.creative_pipeline set status = 'rechazada' where status = 'rechazado';
|
|
update public.creative_pipeline set status = 'publicada' where status = 'publicado';
|
|
|
|
alter table public.creative_pipeline
|
|
alter column status set default 'borrador';
|
|
|
|
alter table public.creative_pipeline
|
|
add constraint creative_pipeline_status_check
|
|
check (status in (
|
|
'borrador',
|
|
'revision_agencia',
|
|
'pendiente_aprobacion',
|
|
'aprobada',
|
|
'rechazada',
|
|
'publicada'
|
|
));
|
|
|
|
comment on column public.creative_pipeline.status is
|
|
'Flujo unificado: borrador → revision_agencia → pendiente_aprobacion → aprobada|rechazada → publicada';
|
|
|
|
-- ─── creatives (Ads) ────────────────────────────────────────────────────────
|
|
|
|
alter table public.creatives drop constraint if exists creatives_status_check;
|
|
|
|
-- Legacy EN → ES canónico
|
|
update public.creatives set status = 'borrador' where status = 'draft';
|
|
update public.creatives set status = 'pendiente_aprobacion' where status = 'in_review';
|
|
update public.creatives set status = 'aprobada' where status = 'approved';
|
|
update public.creatives set status = 'rechazada' where status = 'rejected';
|
|
|
|
alter table public.creatives
|
|
add constraint creatives_status_check
|
|
check (status in (
|
|
'borrador',
|
|
'revision_agencia',
|
|
'pendiente_aprobacion',
|
|
'aprobada',
|
|
'rechazada',
|
|
'publicada',
|
|
'fatigada',
|
|
'retirada'
|
|
));
|
|
|
|
comment on column public.creatives.status is
|
|
'Flujo unificado + extras Ads (fatigada, retirada). revision_agencia = validación interna antes de enviar al cliente.';
|