ALTER TABLE outbox
    DROP CONSTRAINT IF EXISTS outbox_retry_count_nonnegative_chk;

ALTER TABLE webhook_logs
    DROP CONSTRAINT IF EXISTS webhook_logs_duration_nonnegative_chk;

ALTER TABLE messages
    DROP CONSTRAINT IF EXISTS messages_raw_size_nonnegative_chk;

ALTER TABLE attachments
    DROP CONSTRAINT IF EXISTS attachments_size_nonnegative_chk;

ALTER TABLE mail_rules
    DROP CONSTRAINT IF EXISTS mail_rules_account_user_fk;

ALTER TABLE outbox
    DROP CONSTRAINT IF EXISTS outbox_account_user_fk;

ALTER TABLE messages
    DROP CONSTRAINT IF EXISTS messages_folder_account_fk;

DROP INDEX IF EXISTS uq_mail_folders_id_account;
DROP INDEX IF EXISTS uq_mail_accounts_id_user;
DROP INDEX IF EXISTS idx_outbox_account_status;
DROP INDEX IF EXISTS idx_outbox_status_created;
DROP INDEX IF EXISTS idx_webhook_templates_user_active;
DROP INDEX IF EXISTS idx_mail_rules_user_active_priority;
DROP INDEX IF EXISTS idx_messages_folder_date;
DROP INDEX IF EXISTS idx_messages_account_date;
DROP INDEX IF EXISTS idx_mail_accounts_user_created;
