-- Migration: Add Reminder Tracking Fields to User Model
--
-- This migration adds fields to track reminder emails sent to users,
-- allowing admins to see how many reminders each user has received
-- and when the last reminder was sent.
--
-- This is especially helpful for older members who may need personal outreach.

-- Add email verification reminder tracking
ALTER TABLE users
ADD COLUMN email_verification_reminders_sent INTEGER DEFAULT 0 NOT NULL;

ALTER TABLE users
ADD COLUMN last_email_verification_reminder_at TIMESTAMP WITH TIME ZONE;

-- Add event attendance reminder tracking
ALTER TABLE users
ADD COLUMN event_attendance_reminders_sent INTEGER DEFAULT 0 NOT NULL;

ALTER TABLE users
ADD COLUMN last_event_attendance_reminder_at TIMESTAMP WITH TIME ZONE;

-- Add payment reminder tracking
ALTER TABLE users
ADD COLUMN payment_reminders_sent INTEGER DEFAULT 0 NOT NULL;

ALTER TABLE users
ADD COLUMN last_payment_reminder_at TIMESTAMP WITH TIME ZONE;

-- Add renewal reminder tracking
ALTER TABLE users
ADD COLUMN renewal_reminders_sent INTEGER DEFAULT 0 NOT NULL;

ALTER TABLE users
ADD COLUMN last_renewal_reminder_at TIMESTAMP WITH TIME ZONE;

-- Success message
SELECT 'Migration completed: Reminder tracking fields added to users table' AS result;
SELECT 'Admins can now track reminder counts in the dashboard' AS note;
