-- Drop functions
DROP FUNCTION IF EXISTS search_outgoing_letters(text);
DROP FUNCTION IF EXISTS search_incoming_letters(text);

-- Drop indexes for outgoing letters
DROP INDEX IF EXISTS idx_letters_outgoing_letter_number_text;
DROP INDEX IF EXISTS idx_letters_outgoing_subject_text;
DROP INDEX IF EXISTS idx_letters_outgoing_description_text;
DROP INDEX IF EXISTS idx_letters_outgoing_reference_number_text;
DROP INDEX IF EXISTS idx_letters_outgoing_status_created;
DROP INDEX IF EXISTS idx_letters_outgoing_priority_created;
DROP INDEX IF EXISTS idx_letters_outgoing_institution_created;
DROP INDEX IF EXISTS idx_letters_outgoing_created_by;
DROP INDEX IF EXISTS idx_letters_outgoing_issue_date;

-- Drop indexes for incoming letters
DROP INDEX IF EXISTS idx_letters_incoming_letter_number_text;
DROP INDEX IF EXISTS idx_letters_incoming_subject_text;
DROP INDEX IF EXISTS idx_letters_incoming_description_text;
DROP INDEX IF EXISTS idx_letters_incoming_reference_number_text;
DROP INDEX IF EXISTS idx_letters_incoming_status_created;
DROP INDEX IF EXISTS idx_letters_incoming_priority_created;
DROP INDEX IF EXISTS idx_letters_incoming_institution_created;
DROP INDEX IF EXISTS idx_letters_incoming_created_by;
DROP INDEX IF EXISTS idx_letters_incoming_received_date;

-- Drop recipient indexes
DROP INDEX IF EXISTS idx_letter_outgoing_recipients_user;
DROP INDEX IF EXISTS idx_letter_outgoing_recipients_dept;
DROP INDEX IF EXISTS idx_letter_incoming_recipients_user;
DROP INDEX IF EXISTS idx_letter_incoming_recipients_dept;