-- Extend backup_type enums to support PostgreSQL backups.
--
-- The existing scheduler/runner switches on backup_type; adding 'postgres_database'
-- lets new schedules and runs reference per-user PG dumps without conflicting with
-- the existing 'database' (MySQL) path. Idempotent: MODIFY COLUMN with the same
-- definition is a no-op on re-run.
--
-- This migration was originally shipped without preserving 'wordpress' (added by
-- 2025.08.49); on production that triggered Data-truncation against existing
-- wordpress rows and aborted the update. Edited in place with the full union so
-- un-updated installs (incl. production) get the right enum on first apply.
-- Servers that already applied the broken version (e.g. staging) get fixed
-- forward by the sibling migration in 2026.04.113.

USE whp;

ALTER TABLE backup_history    MODIFY COLUMN backup_type
    ENUM('site','userfiles','database','wordpress','postgres_database') NOT NULL;

ALTER TABLE backup_queue      MODIFY COLUMN backup_type
    ENUM('site','userfiles','database','wordpress','postgres_database') NOT NULL;

ALTER TABLE backup_schedules  MODIFY COLUMN backup_type
    ENUM('site','userfiles','database','wordpress','postgres_database','all') NOT NULL;
