-- Migration 023: Trial period support
-- Adds trial_ends_at column to subscriptions for 14-day free trial tracking.
-- Also adds trial_notified_at to track when the expiry warning was last sent.

ALTER TABLE subscriptions
    ADD COLUMN trial_ends_at    DATETIME NULL AFTER status,
    ADD COLUMN trial_notified_at DATETIME NULL AFTER trial_ends_at;

-- Index to allow efficient expiry sweeps by the worker
CREATE INDEX idx_sub_trial_ends ON subscriptions (trial_ends_at);
