Correcao Sidebar Classico e Rail, Correcao Layout, Ajuste de Breakpoint para Tailwind, Ajuste AppTopbar, Ajuste Menu PopOver, Recriado Paleta de Cores, Inserido algumas animações leves, Reajuste Cor items NOVOS da tabela, Drawer Ajuda Corrigido no Logout, Whatsapp, sms, email, recursos extras
This commit is contained in:
78
database-novo/fixes/fix_template_keys_match_populate.sql
Normal file
78
database-novo/fixes/fix_template_keys_match_populate.sql
Normal file
@@ -0,0 +1,78 @@
|
||||
-- ============================================================
|
||||
-- Fix: Template keys devem casar com o que populate_notification_queue gera
|
||||
-- Agência PSI — 2026-03-22
|
||||
-- ============================================================
|
||||
-- O populate gera: 'session.' || REPLACE(event_type, '_sessao', '') || '.' || channel
|
||||
-- Ex: event_type='lembrete_sessao' → 'session.lembrete.whatsapp'
|
||||
--
|
||||
-- Os seeds usavam nomes em inglês (session.reminder.whatsapp).
|
||||
-- Este fix renomeia para casar com o populate.
|
||||
-- ============================================================
|
||||
|
||||
-- ── 1. Renomeia templates existentes ──────────────────────────
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.lembrete.whatsapp'
|
||||
WHERE key = 'session.reminder.whatsapp';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.lembrete_2h.whatsapp'
|
||||
WHERE key = 'session.reminder_2h.whatsapp';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.confirmacao.whatsapp'
|
||||
WHERE key = 'session.confirmation.whatsapp';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.cancelamento.whatsapp'
|
||||
WHERE key = 'session.cancellation.whatsapp';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.reagendamento.whatsapp'
|
||||
WHERE key = 'session.reschedule.whatsapp';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'cobranca.pendente.whatsapp'
|
||||
WHERE key = 'billing.pending.whatsapp';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'sistema.boas_vindas.whatsapp'
|
||||
WHERE key = 'system.welcome.whatsapp';
|
||||
|
||||
-- ── SMS templates (mesmo padrão) ──────────────────────────────
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.lembrete.sms'
|
||||
WHERE key = 'session.reminder.sms';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.lembrete_2h.sms'
|
||||
WHERE key = 'session.reminder_2h.sms';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.confirmacao.sms'
|
||||
WHERE key = 'session.confirmation.sms';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.cancelamento.sms'
|
||||
WHERE key = 'session.cancellation.sms';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'session.reagendamento.sms'
|
||||
WHERE key = 'session.reschedule.sms';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'cobranca.pendente.sms'
|
||||
WHERE key = 'billing.pending.sms';
|
||||
|
||||
UPDATE public.notification_templates
|
||||
SET key = 'sistema.boas_vindas.sms'
|
||||
WHERE key = 'system.welcome.sms';
|
||||
|
||||
|
||||
-- ── 2. Verifica resultado ─────────────────────────────────────
|
||||
|
||||
SELECT key, channel, domain, event_type, is_default
|
||||
FROM notification_templates
|
||||
WHERE deleted_at IS NULL
|
||||
ORDER BY channel, key;
|
||||
Reference in New Issue
Block a user