-- Migration: tier_system_phase2
-- Downgrade-Reconciliation, Founding-Members, GlobalBlocklist-Grace.
-- Neue Felder auf Profile, MailConnection, ProtectedDevice.

-- Profile: founding_member flag + global blocklist grace
ALTER TABLE "rebreak"."profiles"
    ADD COLUMN IF NOT EXISTS "founding_member"              BOOLEAN      NOT NULL DEFAULT FALSE,
    ADD COLUMN IF NOT EXISTS "global_blocklist_grace_until" TIMESTAMPTZ;

-- MailConnection: pause-state für Downgrade-Reconciliation
ALTER TABLE "rebreak"."mail_connections"
    ADD COLUMN IF NOT EXISTS "paused_at"      TIMESTAMPTZ,
    ADD COLUMN IF NOT EXISTS "paused_reason"  TEXT;

-- ProtectedDevice: degraded-state für 14-Tage-Grace nach Downgrade
ALTER TABLE "rebreak"."protected_devices"
    ADD COLUMN IF NOT EXISTS "degraded_at" TIMESTAMPTZ;
