-- ============================================================================ -- Insert Auth Email Verification Template (Fixed) -- ============================================================================ -- First, let's see what columns the table actually has -- This will help us insert correctly -- Check if template exists DO $$ DECLARE template_count int; BEGIN SELECT COUNT(*) INTO template_count FROM notification_templates WHERE key = 'auth_email_verification'; IF template_count = 0 THEN -- Template doesn't exist, insert it INSERT INTO notification_templates ( key, name, is_active, email_subject, email_body_html ) VALUES ( 'auth_email_verification', 'Verifikasi Email - OTP', true, 'Kode Verifikasi Email Anda - {platform_name}', '--- Verifikasi Email

🔐 Verifikasi Email

Halo {nama},

Terima kasih telah mendaftar di {platform_name}! Gunakan kode OTP berikut untuk memverifikasi alamat email Anda:

{otp_code}
⏰ Berlaku selama {expiry_minutes} menit
Cara menggunakan:
1. Salin kode 6 digit di atas
2. Kembali ke halaman pendaftaran
3. Masukkan kode tersebut pada form verifikasi

Jika Anda tidak merasa mendaftar di {platform_name}, abaikan email ini dengan aman.

---' ); RAISE NOTICE 'Auth email verification template inserted successfully'; ELSE RAISE NOTICE 'Template already exists, skipping insertion'; END IF; END $$;