listeven989 / email.dev

open sourced email outbound
https://emaildev.vercel.app
1 stars 2 forks source link

email-service/database/seed.sql file has wrong syntax #73

Open rpiplewar opened 6 months ago

rpiplewar commented 6 months ago

currently, v_campaign_id UUID; is being declared after BEGIN. but the correct syntax that works is the following.

-- Get the IDs of the sample email account and template DO $$ DECLARE v_email_account_id UUID; v_email_template_id UUID; v_campaign_id UUID; BEGIN SELECT id INTO v_email_account_id FROM email_accounts WHERE email_address = 'your_email@zoho.com'; SELECT id INTO v_email_template_id FROM email_templates WHERE name = 'Welcome Email';

-- Insert a sample campaign
INSERT INTO campaigns (email_account_id, email_template_id, name, reply_to_email_address)
VALUES (v_email_account_id, v_email_template_id, 'Sample Campaign', 'your_email@zoho.com');

-- Get the ID of the sample campaign
SELECT id INTO v_campaign_id FROM campaigns WHERE name = 'Sample Campaign';

-- Insert sample recipient emails
INSERT INTO recipient_emails (campaign_id, email_address)
VALUES (v_campaign_id, 'recipient1@example.com'),
       (v_campaign_id, 'recipient2@example.com'),
       (v_campaign_id, 'recipient3@example.com');

END $$;