-- Add shipping related columns to the orders table ALTER TABLE orders ADD COLUMN IF NOT EXISTS shipping_info JSONB; ALTER TABLE orders ADD COLUMN IF NOT EXISTS shipping_date TIMESTAMP; -- Create a notification logs table to track emails sent CREATE TABLE IF NOT EXISTS notification_logs ( id SERIAL PRIMARY KEY, order_id UUID NOT NULL REFERENCES orders(id), notification_type VARCHAR(50) NOT NULL, sent_at TIMESTAMP NOT NULL DEFAULT NOW(), status VARCHAR(20) DEFAULT 'success', error_message TEXT ); -- Create an index on order_id for faster lookups CREATE INDEX IF NOT EXISTS idx_notification_logs_order_id ON notification_logs(order_id);