BEGIN;

-- Drop triggers first
DROP TRIGGER IF EXISTS trg_letter_outgoing_discussions_updated_at ON letter_outgoing_discussions;
DROP TRIGGER IF EXISTS trg_approval_flow_steps_updated_at ON approval_flow_steps;
DROP TRIGGER IF EXISTS trg_approval_flows_updated_at ON approval_flows;
DROP TRIGGER IF EXISTS trg_letters_outgoing_updated_at ON letters_outgoing;

-- Drop tables in reverse order (due to foreign key constraints)
DROP TABLE IF EXISTS letter_outgoing_activity_logs;
DROP TABLE IF EXISTS letter_outgoing_discussion_attachments;
DROP TABLE IF EXISTS letter_outgoing_discussions;
DROP TABLE IF EXISTS letter_outgoing_approvals;
DROP TABLE IF EXISTS letter_outgoing_attachments;
DROP TABLE IF EXISTS letter_outgoing_labels;
DROP TABLE IF EXISTS letter_outgoing_recipients;
DROP TABLE IF EXISTS letters_outgoing;
DROP TABLE IF EXISTS approval_flow_steps;
DROP TABLE IF EXISTS approval_flows;

-- Drop sequence
DROP SEQUENCE IF EXISTS letters_outgoing_seq;

COMMIT;