-- Fix-up for the previous extend-backup-type-postgres migration.
--
-- The earlier migration (2026.04.110/extend-backup-type-postgres.sql) shipped
-- without preserving the 'wordpress' value that 2025.08.49 added to all three
-- enums. On production the truncation guard fired on existing rows with
-- backup_type='wordpress' and the migration aborted.
--
-- This re-defines all three enums with the full union of every value the
-- codebase uses (site, userfiles, database, wordpress, postgres_database) +
-- the 'all' marker on backup_schedules. Idempotent — re-running with the same
-- definition is a no-op.

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;
