-- Add email_templates category in system_settings if needed INSERT INTO system_settings (key, value, category) VALUES ('email_templates_enabled', 'true', 'email') ON CONFLICT (key) DO NOTHING; -- Add email_logs table for template logs if it doesn't exist ALTER TABLE email_logs ADD COLUMN IF NOT EXISTS template_id VARCHAR(255); ALTER TABLE email_logs ADD COLUMN IF NOT EXISTS template_type VARCHAR(50); -- Create default login code template INSERT INTO system_settings (key, value, category) VALUES ( 'email_template_login_code_default', '{"name":"Login Code Template","type":"login_code","subject":"Your Login Code","content":"

Your login code is: {{code}}

This code will expire in 15 minutes.

Or click here to log in directly.

","isDefault":true,"createdAt":"2025-04-29T00:00:00.000Z"}', 'email_templates' ) ON CONFLICT (key) DO NOTHING; -- Create default shipping notification template INSERT INTO system_settings (key, value, category) VALUES ( 'email_template_shipping_notification_default', '{"name":"Shipping Notification Template","type":"shipping_notification","subject":"Your Order Has Shipped!","content":"

Your Order Has Shipped!

Order #{{order_id}}

Hello {{first_name}},

Good news! Your order has been shipped and is on its way to you.

Shipping Details

Carrier: {{carrier}}

Tracking Number: {{tracking_number}}

Shipped On: {{shipped_date}}

Estimated Delivery: {{estimated_delivery}}

Order Summary

{{items_html}}
ItemQtyPriceTotal

Thank you for your purchase!

© 2025 Rocks, Bones & Sticks. All rights reserved.

","isDefault":true,"createdAt":"2025-04-29T00:00:00.000Z"}', 'email_templates' ) ON CONFLICT (key) DO NOTHING; -- Create default order confirmation template INSERT INTO system_settings (key, value, category) VALUES ( 'email_template_order_confirmation_default', '{"name":"Order Confirmation Template","type":"order_confirmation","subject":"Order Confirmation","content":"

Order Confirmation

Order #{{order_id}}

Hello {{first_name}},

Thank you for your order! We are processing it now and will send you another email when it ships.

Order Details

Order Date: {{order_date}}

Order Total: {{order_total}}

Shipping To: {{shipping_address}}

Order Summary

{{items_html}}
ItemQtyPriceTotal

© 2025 Rocks, Bones & Sticks. All rights reserved.

","isDefault":true,"createdAt":"2025-04-29T00:00:00.000Z"}', 'email_templates' ) ON CONFLICT (key) DO NOTHING; -- Create default low stock alert template INSERT INTO system_settings (key, value, category) VALUES ( 'email_template_low_stock_alert_default', '{"name":"Low Stock Alert Template","type":"low_stock_alert","subject":"Low Stock Alert: {{product_name}}","content":"

Low Stock Alert

Hello,

This is an automated notification to inform you that the following product is running low on stock:

{{product_name}}

Current Stock: {{current_stock}}

Threshold: {{threshold}}

You might want to restock this item soon to avoid running out of inventory.

© 2025 Rocks, Bones & Sticks. All rights reserved.

","isDefault":true,"createdAt":"2025-04-29T00:00:00.000Z"}', 'email_templates' ) ON CONFLICT (key) DO NOTHING; -- Create default welcome email template INSERT INTO system_settings (key, value, category) VALUES ( 'email_template_welcome_email_default', '{"name":"Welcome Email Template","type":"welcome_email","subject":"Welcome to Rocks, Bones & Sticks!","content":"

Welcome to Rocks, Bones & Sticks!

Hello {{first_name}},

Thank you for creating an account with us. We are excited to have you join our community of natural curiosity enthusiasts!

As a member, you will enjoy:

Start exploring our collections today and discover the beauty of nature!

Shop Now

© 2025 Rocks, Bones & Sticks. All rights reserved.

","isDefault":true,"createdAt":"2025-04-29T00:00:00.000Z"}', 'email_templates' ) ON CONFLICT (key) DO NOTHING;