Skip to content

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

@rpiplewar

Description

@rpiplewar

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 $$;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions