-- 001_cpanel_imports_email_summary_to.sql
-- Drop legacy denormalized child tables from the original cPanel-import scaffolding.
-- These either were never written to or their data is unused by any panel UI.
-- Mailboxes/forwarders now flow into whp.email_accounts and whp.email_forwarders
-- (their natural home). Domains/databases/files/mysql users are tracked in
-- the worker log + per-import JSON summary file under /var/lib/whp/cpanel-imports/.

DROP TABLE IF EXISTS whp.cpanel_imported_files;
DROP TABLE IF EXISTS whp.cpanel_imported_mysql_users;
DROP TABLE IF EXISTS whp.cpanel_imported_databases;
DROP TABLE IF EXISTS whp.cpanel_imported_domains;

-- Add: capture the email-summary recipient set on the import form.
-- NULL means "do not email a summary."
ALTER TABLE whp.cpanel_imports
    ADD COLUMN IF NOT EXISTS email_summary_to VARCHAR(255) NULL
    COMMENT 'Recipient for the post-import summary email; NULL means do not email';
