--- /dev/null
+-- Ensure we are using InnoDB as engine.
+
+ALTER TABLE `cache` ENGINE=InnoDB;
+ALTER TABLE `session` ENGINE=InnoDB;
+ALTER TABLE `messages` ENGINE=InnoDB;
+ALTER TABLE `users` ENGINE=InnoDB;
+ALTER TABLE `contacts` ENGINE=InnoDB;
+ALTER TABLE `identities` ENGINE=InnoDB;
+
+-- Updates from version 0.3-stable
+
+TRUNCATE `messages`;
+
+ALTER TABLE `messages`
+ ADD INDEX `index_index` (`user_id`, `cache_key`, `idx`);
+
+ALTER TABLE `session`
+ CHANGE `vars` `vars` MEDIUMTEXT NOT NULL;
+
+ALTER TABLE `contacts`
+ ADD INDEX `user_contacts_index` (`user_id`,`email`);
+
+-- Updates from version 0.3.1
+-- WARNING: Make sure that all tables are using InnoDB engine!!!
+-- If not, use: ALTER TABLE xxx ENGINE=InnoDB;
+
+/* MySQL bug workaround: http://bugs.mysql.com/bug.php?id=46293 */
+/*!40014 SET FOREIGN_KEY_CHECKS=0 */;
+
+ALTER TABLE `messages` DROP FOREIGN KEY `user_id_fk_messages`;
+ALTER TABLE `cache` DROP FOREIGN KEY `user_id_fk_cache`;
+ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`;
+ALTER TABLE `identities` DROP FOREIGN KEY `user_id_fk_identities`;
+
+ALTER TABLE `messages` ADD CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE `cache` ADD CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
+ALTER TABLE `identities` ADD CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
+
+ALTER TABLE `contacts` ALTER `name` SET DEFAULT '';
+ALTER TABLE `contacts` ALTER `firstname` SET DEFAULT '';
+ALTER TABLE `contacts` ALTER `surname` SET DEFAULT '';
+
+ALTER TABLE `identities` ADD INDEX `user_identities_index` (`user_id`, `del`);
+ALTER TABLE `identities` ADD `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00' AFTER `user_id`;
+
+CREATE TABLE `contactgroups` (
+ `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
+ `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
+ `del` tinyint(1) NOT NULL DEFAULT '0',
+ `name` varchar(128) NOT NULL DEFAULT '',
+ PRIMARY KEY(`contactgroup_id`),
+ CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`)
+ REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ INDEX `contactgroups_user_index` (`user_id`,`del`)
+) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
+
+CREATE TABLE `contactgroupmembers` (
+ `contactgroup_id` int(10) UNSIGNED NOT NULL,
+ `contact_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
+ `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
+ PRIMARY KEY (`contactgroup_id`, `contact_id`),
+ CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`)
+ REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`)
+ REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE
+) /*!40000 ENGINE=INNODB */;
+
+/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
+
+-- Updates from version 0.4-beta
+
+ALTER TABLE `users` CHANGE `last_login` `last_login` datetime DEFAULT NULL;
+UPDATE `users` SET `last_login` = NULL WHERE `last_login` = '1000-01-01 00:00:00';
+
+-- Updates from version 0.4.2
+
+ALTER TABLE `users` DROP INDEX `username_index`;
+ALTER TABLE `users` ADD UNIQUE `username` (`username`, `mail_host`);
+
+ALTER TABLE `contacts` MODIFY `email` varchar(255) NOT NULL;
+
+++ /dev/null
--- Ensure we are using InnoDB as engine.
-
-ALTER TABLE `cache` ENGINE=InnoDB;
-ALTER TABLE `session` ENGINE=InnoDB;
-ALTER TABLE `messages` ENGINE=InnoDB;
-ALTER TABLE `users` ENGINE=InnoDB;
-ALTER TABLE `contacts` ENGINE=InnoDB;
-ALTER TABLE `identities` ENGINE=InnoDB;
-
--- Updates from version 0.3-stable
-
-TRUNCATE `messages`;
-
-ALTER TABLE `messages`
- ADD INDEX `index_index` (`user_id`, `cache_key`, `idx`);
-
-ALTER TABLE `session`
- CHANGE `vars` `vars` MEDIUMTEXT NOT NULL;
-
-ALTER TABLE `contacts`
- ADD INDEX `user_contacts_index` (`user_id`,`email`);
-
--- Updates from version 0.3.1
--- WARNING: Make sure that all tables are using InnoDB engine!!!
--- If not, use: ALTER TABLE xxx ENGINE=InnoDB;
-
-/* MySQL bug workaround: http://bugs.mysql.com/bug.php?id=46293 */
-/*!40014 SET FOREIGN_KEY_CHECKS=0 */;
-
-ALTER TABLE `messages` DROP FOREIGN KEY `user_id_fk_messages`;
-ALTER TABLE `cache` DROP FOREIGN KEY `user_id_fk_cache`;
-ALTER TABLE `contacts` DROP FOREIGN KEY `user_id_fk_contacts`;
-ALTER TABLE `identities` DROP FOREIGN KEY `user_id_fk_identities`;
-
-ALTER TABLE `messages` ADD CONSTRAINT `user_id_fk_messages` FOREIGN KEY (`user_id`)
- REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-ALTER TABLE `cache` ADD CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`)
- REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-ALTER TABLE `contacts` ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`)
- REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-ALTER TABLE `identities` ADD CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`)
- REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE;
-
-ALTER TABLE `contacts` ALTER `name` SET DEFAULT '';
-ALTER TABLE `contacts` ALTER `firstname` SET DEFAULT '';
-ALTER TABLE `contacts` ALTER `surname` SET DEFAULT '';
-
-ALTER TABLE `identities` ADD INDEX `user_identities_index` (`user_id`, `del`);
-ALTER TABLE `identities` ADD `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00' AFTER `user_id`;
-
-CREATE TABLE `contactgroups` (
- `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
- `user_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
- `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
- `del` tinyint(1) NOT NULL DEFAULT '0',
- `name` varchar(128) NOT NULL DEFAULT '',
- PRIMARY KEY(`contactgroup_id`),
- CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`)
- REFERENCES `users`(`user_id`) ON DELETE CASCADE ON UPDATE CASCADE,
- INDEX `contactgroups_user_index` (`user_id`,`del`)
-) /*!40000 ENGINE=INNODB */ /*!40101 CHARACTER SET utf8 COLLATE utf8_general_ci */;
-
-CREATE TABLE `contactgroupmembers` (
- `contactgroup_id` int(10) UNSIGNED NOT NULL,
- `contact_id` int(10) UNSIGNED NOT NULL DEFAULT '0',
- `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
- PRIMARY KEY (`contactgroup_id`, `contact_id`),
- CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`)
- REFERENCES `contactgroups`(`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE,
- CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`)
- REFERENCES `contacts`(`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE
-) /*!40000 ENGINE=INNODB */;
-
-/*!40014 SET FOREIGN_KEY_CHECKS=1 */;
-
--- Updates from version 0.4-beta
-
-ALTER TABLE `users` CHANGE `last_login` `last_login` datetime DEFAULT NULL;
-UPDATE `users` SET `last_login` = NULL WHERE `last_login` = '1000-01-01 00:00:00';
-
--- Updates from version 0.4.2
-
-ALTER TABLE `users` DROP INDEX `username_index`;
-ALTER TABLE `users` ADD UNIQUE `username` (`username`, `mail_host`);
-
-ALTER TABLE `contacts` MODIFY `email` varchar(255) NOT NULL;
-
--- /dev/null
+-- Updates from version 0.3-stable
+
+TRUNCATE messages;
+CREATE INDEX messages_index_idx ON messages (user_id, cache_key, idx);
+DROP INDEX contacts_user_id_idx;
+CREATE INDEX contacts_user_id_idx ON contacts (user_id, email);
+
+-- Updates from version 0.3.1
+
+DROP INDEX identities_user_id_idx;
+CREATE INDEX identities_user_id_idx ON identities (user_id, del);
+
+ALTER TABLE identities ADD changed timestamp with time zone DEFAULT now() NOT NULL;
+
+CREATE SEQUENCE contactgroups_ids
+ INCREMENT BY 1
+ NO MAXVALUE
+ NO MINVALUE
+ CACHE 1;
+
+CREATE TABLE contactgroups (
+ contactgroup_id integer DEFAULT nextval('contactgroups_ids'::text) PRIMARY KEY,
+ user_id integer NOT NULL
+ REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE,
+ changed timestamp with time zone DEFAULT now() NOT NULL,
+ del smallint NOT NULL DEFAULT 0,
+ name varchar(128) NOT NULL DEFAULT ''
+);
+
+CREATE INDEX contactgroups_user_id_idx ON contactgroups (user_id, del);
+
+CREATE TABLE contactgroupmembers (
+ contactgroup_id integer NOT NULL
+ REFERENCES contactgroups(contactgroup_id) ON DELETE CASCADE ON UPDATE CASCADE,
+ contact_id integer NOT NULL
+ REFERENCES contacts(contact_id) ON DELETE CASCADE ON UPDATE CASCADE,
+ created timestamp with time zone DEFAULT now() NOT NULL,
+ PRIMARY KEY (contactgroup_id, contact_id)
+);
+
+-- Updates from version 0.4-beta
+
+ALTER TABLE users ALTER last_login DROP NOT NULL;
+ALTER TABLE users ALTER last_login SET DEFAULT NULL;
+
+-- Updates from version 0.4.2
+
+DROP INDEX users_username_id_idx;
+ALTER TABLE users ADD UNIQUE (username, mail_host);
+ALTER TABLE contacts ALTER email TYPE varchar(255);
+
+++ /dev/null
--- Updates from version 0.3-stable
-
-TRUNCATE messages;
-CREATE INDEX messages_index_idx ON messages (user_id, cache_key, idx);
-DROP INDEX contacts_user_id_idx;
-CREATE INDEX contacts_user_id_idx ON contacts (user_id, email);
-
--- Updates from version 0.3.1
-
-DROP INDEX identities_user_id_idx;
-CREATE INDEX identities_user_id_idx ON identities (user_id, del);
-
-ALTER TABLE identities ADD changed timestamp with time zone DEFAULT now() NOT NULL;
-
-CREATE SEQUENCE contactgroups_ids
- INCREMENT BY 1
- NO MAXVALUE
- NO MINVALUE
- CACHE 1;
-
-CREATE TABLE contactgroups (
- contactgroup_id integer DEFAULT nextval('contactgroups_ids'::text) PRIMARY KEY,
- user_id integer NOT NULL
- REFERENCES users(user_id) ON DELETE CASCADE ON UPDATE CASCADE,
- changed timestamp with time zone DEFAULT now() NOT NULL,
- del smallint NOT NULL DEFAULT 0,
- name varchar(128) NOT NULL DEFAULT ''
-);
-
-CREATE INDEX contactgroups_user_id_idx ON contactgroups (user_id, del);
-
-CREATE TABLE contactgroupmembers (
- contactgroup_id integer NOT NULL
- REFERENCES contactgroups(contactgroup_id) ON DELETE CASCADE ON UPDATE CASCADE,
- contact_id integer NOT NULL
- REFERENCES contacts(contact_id) ON DELETE CASCADE ON UPDATE CASCADE,
- created timestamp with time zone DEFAULT now() NOT NULL,
- PRIMARY KEY (contactgroup_id, contact_id)
-);
-
--- Updates from version 0.4-beta
-
-ALTER TABLE users ALTER last_login DROP NOT NULL;
-ALTER TABLE users ALTER last_login SET DEFAULT NULL;
-
--- Updates from version 0.4.2
-
-DROP INDEX users_username_id_idx;
-ALTER TABLE users ADD UNIQUE (username, mail_host);
-ALTER TABLE contacts ALTER email TYPE varchar(255);
-
--- /dev/null
+-- Updates from version 0.3-stable
+
+DELETE FROM messages;
+DROP INDEX ix_messages_user_cache_uid;
+CREATE UNIQUE INDEX ix_messages_user_cache_uid ON messages (user_id,cache_key,uid);
+CREATE INDEX ix_messages_index ON messages (user_id,cache_key,idx);
+DROP INDEX ix_contacts_user_id;
+CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);
+
+-- Updates from version 0.3.1
+
+-- ALTER TABLE identities ADD COLUMN changed datetime NOT NULL default '0000-00-00 00:00:00'; --
+
+CREATE TABLE temp_identities (
+ identity_id integer NOT NULL PRIMARY KEY,
+ user_id integer NOT NULL default '0',
+ standard tinyint NOT NULL default '0',
+ name varchar(128) NOT NULL default '',
+ organization varchar(128) default '',
+ email varchar(128) NOT NULL default '',
+ "reply-to" varchar(128) NOT NULL default '',
+ bcc varchar(128) NOT NULL default '',
+ signature text NOT NULL default '',
+ html_signature tinyint NOT NULL default '0'
+);
+INSERT INTO temp_identities (identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature)
+ SELECT identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature
+ FROM identities WHERE del=0;
+
+DROP INDEX ix_identities_user_id;
+DROP TABLE identities;
+
+CREATE TABLE identities (
+ identity_id integer NOT NULL PRIMARY KEY,
+ user_id integer NOT NULL default '0',
+ changed datetime NOT NULL default '0000-00-00 00:00:00',
+ del tinyint NOT NULL default '0',
+ standard tinyint NOT NULL default '0',
+ name varchar(128) NOT NULL default '',
+ organization varchar(128) default '',
+ email varchar(128) NOT NULL default '',
+ "reply-to" varchar(128) NOT NULL default '',
+ bcc varchar(128) NOT NULL default '',
+ signature text NOT NULL default '',
+ html_signature tinyint NOT NULL default '0'
+);
+CREATE INDEX ix_identities_user_id ON identities(user_id, del);
+
+INSERT INTO identities (identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature)
+ SELECT identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature
+ FROM temp_identities;
+
+DROP TABLE temp_identities;
+
+CREATE TABLE contactgroups (
+ contactgroup_id integer NOT NULL PRIMARY KEY,
+ user_id integer NOT NULL default '0',
+ changed datetime NOT NULL default '0000-00-00 00:00:00',
+ del tinyint NOT NULL default '0',
+ name varchar(128) NOT NULL default ''
+);
+
+CREATE INDEX ix_contactgroups_user_id ON contactgroups(user_id, del);
+
+CREATE TABLE contactgroupmembers (
+ contactgroup_id integer NOT NULL,
+ contact_id integer NOT NULL default '0',
+ created datetime NOT NULL default '0000-00-00 00:00:00',
+ PRIMARY KEY (contactgroup_id, contact_id)
+);
+
+-- Updates from version 0.3.1
+
+CREATE TABLE tmp_users (
+ user_id integer NOT NULL PRIMARY KEY,
+ username varchar(128) NOT NULL default '',
+ mail_host varchar(128) NOT NULL default '',
+ alias varchar(128) NOT NULL default '',
+ created datetime NOT NULL default '0000-00-00 00:00:00',
+ last_login datetime NOT NULL default '0000-00-00 00:00:00',
+ language varchar(5),
+ preferences text NOT NULL default ''
+);
+
+INSERT INTO tmp_users (user_id, username, mail_host, alias, created, last_login, language, preferences)
+ SELECT user_id, username, mail_host, alias, created, last_login, language, preferences FROM users;
+
+DROP TABLE users;
+
+CREATE TABLE users (
+ user_id integer NOT NULL PRIMARY KEY,
+ username varchar(128) NOT NULL default '',
+ mail_host varchar(128) NOT NULL default '',
+ alias varchar(128) NOT NULL default '',
+ created datetime NOT NULL default '0000-00-00 00:00:00',
+ last_login datetime DEFAULT NULL,
+ language varchar(5),
+ preferences text NOT NULL default ''
+);
+
+INSERT INTO users (user_id, username, mail_host, alias, created, last_login, language, preferences)
+ SELECT user_id, username, mail_host, alias, created, last_login, language, preferences FROM tmp_users;
+
+CREATE INDEX ix_users_username ON users(username);
+CREATE INDEX ix_users_alias ON users(alias);
+DROP TABLE tmp_users;
+
+-- Updates from version 0.4.2
+
+DROP INDEX ix_users_username;
+CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);
+
+CREATE TABLE contacts_tmp (
+ contact_id integer NOT NULL PRIMARY KEY,
+ user_id integer NOT NULL default '0',
+ changed datetime NOT NULL default '0000-00-00 00:00:00',
+ del tinyint NOT NULL default '0',
+ name varchar(128) NOT NULL default '',
+ email varchar(255) NOT NULL default '',
+ firstname varchar(128) NOT NULL default '',
+ surname varchar(128) NOT NULL default '',
+ vcard text NOT NULL default ''
+);
+
+INSERT INTO contacts_tmp (contact_id, user_id, changed, del, name, email, firstname, surname, vcard)
+ SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts;
+
+DROP TABLE contacts;
+CREATE TABLE contacts (
+ contact_id integer NOT NULL PRIMARY KEY,
+ user_id integer NOT NULL default '0',
+ changed datetime NOT NULL default '0000-00-00 00:00:00',
+ del tinyint NOT NULL default '0',
+ name varchar(128) NOT NULL default '',
+ email varchar(255) NOT NULL default '',
+ firstname varchar(128) NOT NULL default '',
+ surname varchar(128) NOT NULL default '',
+ vcard text NOT NULL default ''
+);
+
+INSERT INTO contacts (contact_id, user_id, changed, del, name, email, firstname, surname, vcard)
+ SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts_tmp;
+
+CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);
+DROP TABLE contacts_tmp;
+
+++ /dev/null
--- Updates from version 0.3-stable
-
-DELETE FROM messages;
-DROP INDEX ix_messages_user_cache_uid;
-CREATE UNIQUE INDEX ix_messages_user_cache_uid ON messages (user_id,cache_key,uid);
-CREATE INDEX ix_messages_index ON messages (user_id,cache_key,idx);
-DROP INDEX ix_contacts_user_id;
-CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);
-
--- Updates from version 0.3.1
-
--- ALTER TABLE identities ADD COLUMN changed datetime NOT NULL default '0000-00-00 00:00:00'; --
-
-CREATE TABLE temp_identities (
- identity_id integer NOT NULL PRIMARY KEY,
- user_id integer NOT NULL default '0',
- standard tinyint NOT NULL default '0',
- name varchar(128) NOT NULL default '',
- organization varchar(128) default '',
- email varchar(128) NOT NULL default '',
- "reply-to" varchar(128) NOT NULL default '',
- bcc varchar(128) NOT NULL default '',
- signature text NOT NULL default '',
- html_signature tinyint NOT NULL default '0'
-);
-INSERT INTO temp_identities (identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature)
- SELECT identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature
- FROM identities WHERE del=0;
-
-DROP INDEX ix_identities_user_id;
-DROP TABLE identities;
-
-CREATE TABLE identities (
- identity_id integer NOT NULL PRIMARY KEY,
- user_id integer NOT NULL default '0',
- changed datetime NOT NULL default '0000-00-00 00:00:00',
- del tinyint NOT NULL default '0',
- standard tinyint NOT NULL default '0',
- name varchar(128) NOT NULL default '',
- organization varchar(128) default '',
- email varchar(128) NOT NULL default '',
- "reply-to" varchar(128) NOT NULL default '',
- bcc varchar(128) NOT NULL default '',
- signature text NOT NULL default '',
- html_signature tinyint NOT NULL default '0'
-);
-CREATE INDEX ix_identities_user_id ON identities(user_id, del);
-
-INSERT INTO identities (identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature)
- SELECT identity_id, user_id, standard, name, organization, email, "reply-to", bcc, signature, html_signature
- FROM temp_identities;
-
-DROP TABLE temp_identities;
-
-CREATE TABLE contactgroups (
- contactgroup_id integer NOT NULL PRIMARY KEY,
- user_id integer NOT NULL default '0',
- changed datetime NOT NULL default '0000-00-00 00:00:00',
- del tinyint NOT NULL default '0',
- name varchar(128) NOT NULL default ''
-);
-
-CREATE INDEX ix_contactgroups_user_id ON contactgroups(user_id, del);
-
-CREATE TABLE contactgroupmembers (
- contactgroup_id integer NOT NULL,
- contact_id integer NOT NULL default '0',
- created datetime NOT NULL default '0000-00-00 00:00:00',
- PRIMARY KEY (contactgroup_id, contact_id)
-);
-
--- Updates from version 0.3.1
-
-CREATE TABLE tmp_users (
- user_id integer NOT NULL PRIMARY KEY,
- username varchar(128) NOT NULL default '',
- mail_host varchar(128) NOT NULL default '',
- alias varchar(128) NOT NULL default '',
- created datetime NOT NULL default '0000-00-00 00:00:00',
- last_login datetime NOT NULL default '0000-00-00 00:00:00',
- language varchar(5),
- preferences text NOT NULL default ''
-);
-
-INSERT INTO tmp_users (user_id, username, mail_host, alias, created, last_login, language, preferences)
- SELECT user_id, username, mail_host, alias, created, last_login, language, preferences FROM users;
-
-DROP TABLE users;
-
-CREATE TABLE users (
- user_id integer NOT NULL PRIMARY KEY,
- username varchar(128) NOT NULL default '',
- mail_host varchar(128) NOT NULL default '',
- alias varchar(128) NOT NULL default '',
- created datetime NOT NULL default '0000-00-00 00:00:00',
- last_login datetime DEFAULT NULL,
- language varchar(5),
- preferences text NOT NULL default ''
-);
-
-INSERT INTO users (user_id, username, mail_host, alias, created, last_login, language, preferences)
- SELECT user_id, username, mail_host, alias, created, last_login, language, preferences FROM tmp_users;
-
-CREATE INDEX ix_users_username ON users(username);
-CREATE INDEX ix_users_alias ON users(alias);
-DROP TABLE tmp_users;
-
--- Updates from version 0.4.2
-
-DROP INDEX ix_users_username;
-CREATE UNIQUE INDEX ix_users_username ON users(username, mail_host);
-
-CREATE TABLE contacts_tmp (
- contact_id integer NOT NULL PRIMARY KEY,
- user_id integer NOT NULL default '0',
- changed datetime NOT NULL default '0000-00-00 00:00:00',
- del tinyint NOT NULL default '0',
- name varchar(128) NOT NULL default '',
- email varchar(255) NOT NULL default '',
- firstname varchar(128) NOT NULL default '',
- surname varchar(128) NOT NULL default '',
- vcard text NOT NULL default ''
-);
-
-INSERT INTO contacts_tmp (contact_id, user_id, changed, del, name, email, firstname, surname, vcard)
- SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts;
-
-DROP TABLE contacts;
-CREATE TABLE contacts (
- contact_id integer NOT NULL PRIMARY KEY,
- user_id integer NOT NULL default '0',
- changed datetime NOT NULL default '0000-00-00 00:00:00',
- del tinyint NOT NULL default '0',
- name varchar(128) NOT NULL default '',
- email varchar(255) NOT NULL default '',
- firstname varchar(128) NOT NULL default '',
- surname varchar(128) NOT NULL default '',
- vcard text NOT NULL default ''
-);
-
-INSERT INTO contacts (contact_id, user_id, changed, del, name, email, firstname, surname, vcard)
- SELECT contact_id, user_id, changed, del, name, email, firstname, surname, vcard FROM contacts_tmp;
-
-CREATE INDEX ix_contacts_user_id ON contacts(user_id, email);
-DROP TABLE contacts_tmp;
-