-- dependson: message_0002
-- model: api.models.message
-- description:
--     ConversationUserStatus and Conversation integrity unique index
--     WARNING: it must be run AFTER msg_integritychk is DONE
-- author: keyang@wanmeizhensuo.com
-- date: 2015.09.25 15:00:00

BEGIN;

DROP INDEX `idx_uid_hash` ON `api_conversation`;
CREATE UNIQUE INDEX `uidx_uid_hash` ON `api_conversation` (`uid_hash`);

DROP INDEX `IDX_CONVERSATION_ID_USER_ID` ON `api_conversationuserstatus`;
CREATE UNIQUE INDEX `uidx_conversation_user` ON `api_conversationuserstatus` (`conversation_id`, `user_id`);

DROP TRIGGER IF EXISTS `cvsr_usr_status_unique`;

DROP TRIGGER IF EXISTS `cvsr_uid_hash_unique`;

COMMIT;
