-- Downgrades from version 0.3.1

TRUNCATE `messages`;

ALTER TABLE `messages` DROP INDEX `index_index`;

ALTER TABLE `session` CHANGE `vars` `vars` text NOT NULL;

-- pek: need to drop the FOREIGN KEY constraint on the users table in order to
--   drop the index that also relies on the users table
ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`;
ALTER TABLE `contacts` DROP INDEX `user_contacts_index`;
ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
    REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;


