-- Add encryption support to messages table
ALTER TABLE `messages` 
ADD COLUMN `iv` VARCHAR(100) DEFAULT NULL AFTER `message_text`,
ADD COLUMN `is_encrypted` BOOLEAN DEFAULT FALSE AFTER `iv`;

-- Ensure conversation_id and message_id are properly indexed
ALTER TABLE `messages`
MODIFY COLUMN `message_id` VARCHAR(100) NOT NULL;
