feat: agregar generación de reportes PDF y recomendaciones para PDVs sin asignar

This commit is contained in:
2026-09-26 10:10:52 -04:00
parent 23e01f398b
commit b3d6653143
49 changed files with 1635 additions and 906 deletions
+24
View File
@@ -0,0 +1,24 @@
alter table public.rutero_proyectos
add column if not exists pais text;
-- Preserve the country of projects created before pais was stored explicitly.
update public.rutero_proyectos proyecto
set pais = source.pais
from (
select distinct on (pdv.proyecto_id)
pdv.proyecto_id,
nullif(trim(pdv.pdv_data ->> 'País'), '') as pais
from public.rutero_proyecto_pdvs pdv
where nullif(trim(pdv.pdv_data ->> 'País'), '') is not null
order by pdv.proyecto_id, pdv.created_at
) source
where proyecto.id = source.proyecto_id
and proyecto.pais is null;
alter table public.rutero_proyectos
alter column estado drop not null,
alter column estado drop default;
update public.rutero_proyectos
set estado = null
where estado = 'borrador';