feat: Implement a new push notification service and enhance appointment reminder functionality with new database columns and logic.
This commit is contained in:
13
supabase/migrations/update_reminders.sql
Normal file
13
supabase/migrations/update_reminders.sql
Normal file
@@ -0,0 +1,13 @@
|
||||
-- 1. Adicionar coluna para controlo de lembretes enviados
|
||||
-- Isto evita que o utilizador receba o mesmo lembrete várias vezes
|
||||
ALTER TABLE appointments
|
||||
ADD COLUMN IF NOT EXISTS reminder_sent BOOLEAN DEFAULT false;
|
||||
|
||||
-- 2. Garantir que a coluna reminder_minutes existe (caso não tenha sido criada no outro PC)
|
||||
ALTER TABLE appointments
|
||||
ADD COLUMN IF NOT EXISTS reminder_minutes INTEGER DEFAULT 1440;
|
||||
|
||||
-- 3. Criar índice para performance na busca de lembretes pendentes
|
||||
CREATE INDEX IF NOT EXISTS idx_appointments_reminder_status
|
||||
ON appointments (status, reminder_sent)
|
||||
WHERE status = 'pendente' AND reminder_sent = false;
|
||||
Reference in New Issue
Block a user