diff --git a/vmail.sql b/vmail.sql index cbc5dfa..c46590c 100644 --- a/vmail.sql +++ b/vmail.sql @@ -1,5 +1,4 @@ -- Host: localhost --- Generation Time: Mar 30, 2021 at 03:03 PM SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; START TRANSACTION; @@ -14,324 +13,8 @@ SET time_zone = "+00:00"; -- -- Database: `vmail` -- - --- -------------------------------------------------------- - --- --- Table structure for table `rc_cache` --- - -CREATE TABLE `rc_cache` ( - `user_id` int(10) UNSIGNED NOT NULL, - `cache_key` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `expires` datetime DEFAULT NULL, - `data` longtext NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_cache_index` --- - -CREATE TABLE `rc_cache_index` ( - `user_id` int(10) UNSIGNED NOT NULL, - `mailbox` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `expires` datetime DEFAULT NULL, - `valid` tinyint(1) NOT NULL DEFAULT 0, - `data` longtext NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_cache_messages` --- - -CREATE TABLE `rc_cache_messages` ( - `user_id` int(10) UNSIGNED NOT NULL, - `mailbox` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `uid` int(11) UNSIGNED NOT NULL DEFAULT 0, - `expires` datetime DEFAULT NULL, - `data` longtext NOT NULL, - `flags` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_cache_shared` --- - -CREATE TABLE `rc_cache_shared` ( - `cache_key` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `expires` datetime DEFAULT NULL, - `data` longtext NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_cache_thread` --- - -CREATE TABLE `rc_cache_thread` ( - `user_id` int(10) UNSIGNED NOT NULL, - `mailbox` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `expires` datetime DEFAULT NULL, - `data` longtext NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_carddav_addressbooks` --- - -CREATE TABLE `rc_carddav_addressbooks` ( - `id` int(10) UNSIGNED NOT NULL, - `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `username` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `password` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `url` varchar(4095) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `active` tinyint(3) UNSIGNED NOT NULL DEFAULT 1, - `user_id` int(10) UNSIGNED NOT NULL, - `last_updated` timestamp NOT NULL DEFAULT '2000-01-01 08:00:01', - `refresh_time` time NOT NULL DEFAULT '01:00:00', - `sync_token` text COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `presetname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `use_categories` int(11) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_carddav_contacts` --- - -CREATE TABLE `rc_carddav_contacts` ( - `id` int(10) UNSIGNED NOT NULL, - `abook_id` int(10) UNSIGNED NOT NULL, - `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `email` varchar(4095) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `firstname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `surname` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `organization` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `showas` varchar(32) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `vcard` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `etag` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `uri` varchar(700) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `cuid` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_carddav_groups` --- - -CREATE TABLE `rc_carddav_groups` ( - `id` int(10) UNSIGNED NOT NULL, - `abook_id` int(10) UNSIGNED NOT NULL, - `name` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `vcard` longtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `etag` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `uri` varchar(700) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `cuid` varchar(255) COLLATE utf8mb4_unicode_ci DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_carddav_group_user` --- - -CREATE TABLE `rc_carddav_group_user` ( - `group_id` int(10) UNSIGNED NOT NULL, - `contact_id` int(10) UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_carddav_migrations` --- - -CREATE TABLE `rc_carddav_migrations` ( - `ID` bigint(20) UNSIGNED NOT NULL, - `filename` varchar(64) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `processed_at` timestamp NOT NULL DEFAULT current_timestamp() -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_carddav_xsubtypes` --- - -CREATE TABLE `rc_carddav_xsubtypes` ( - `id` int(10) UNSIGNED NOT NULL, - `typename` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `subtype` varchar(128) COLLATE utf8mb4_unicode_ci DEFAULT NULL, - `abook_id` int(10) UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_contactgroupmembers` --- - -CREATE TABLE `rc_contactgroupmembers` ( - `contactgroup_id` int(10) UNSIGNED NOT NULL, - `contact_id` int(10) UNSIGNED NOT NULL, - `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00' -) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_contactgroups` --- - -CREATE TABLE `rc_contactgroups` ( - `contactgroup_id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', - `del` tinyint(1) NOT NULL DEFAULT 0, - `name` varchar(128) NOT NULL DEFAULT '' -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_contacts` --- - -CREATE TABLE `rc_contacts` ( - `contact_id` int(10) UNSIGNED NOT NULL, - `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', - `del` tinyint(1) NOT NULL DEFAULT 0, - `name` varchar(128) NOT NULL DEFAULT '', - `email` text NOT NULL, - `firstname` varchar(128) NOT NULL DEFAULT '', - `surname` varchar(128) NOT NULL DEFAULT '', - `vcard` longtext DEFAULT NULL, - `words` text DEFAULT NULL, - `user_id` int(10) UNSIGNED NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_dictionary` --- - -CREATE TABLE `rc_dictionary` ( - `id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED DEFAULT NULL, - `language` varchar(5) NOT NULL, - `data` longtext NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_filestore` --- - -CREATE TABLE `rc_filestore` ( - `file_id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `context` varchar(32) NOT NULL, - `filename` varchar(128) NOT NULL, - `mtime` int(10) NOT NULL, - `data` longtext NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_identities` --- - -CREATE TABLE `rc_identities` ( - `identity_id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', - `del` tinyint(1) NOT NULL DEFAULT 0, - `standard` tinyint(1) NOT NULL DEFAULT 0, - `name` varchar(128) NOT NULL, - `organization` varchar(128) NOT NULL DEFAULT '', - `email` varchar(128) NOT NULL, - `reply-to` varchar(128) NOT NULL DEFAULT '', - `bcc` varchar(128) NOT NULL DEFAULT '', - `signature` longtext DEFAULT NULL, - `html_signature` tinyint(1) NOT NULL DEFAULT 0 -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_searches` --- - -CREATE TABLE `rc_searches` ( - `search_id` int(10) UNSIGNED NOT NULL, - `user_id` int(10) UNSIGNED NOT NULL, - `type` int(3) NOT NULL DEFAULT 0, - `name` varchar(128) NOT NULL, - `data` text DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_session` --- - -CREATE TABLE `rc_session` ( - `sess_id` varchar(128) NOT NULL, - `changed` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', - `ip` varchar(40) NOT NULL, - `vars` mediumtext NOT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- -------------------------------------------------------- - --- --- Table structure for table `rc_system` --- - -CREATE TABLE `rc_system` ( - `name` varchar(64) NOT NULL, - `value` mediumtext DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - --- --- Dumping data for table `rc_system` --- - -INSERT INTO `rc_system` (`name`, `value`) VALUES -('roundcube-version', '2019092900'); - --- -------------------------------------------------------- - --- --- Table structure for table `rc_users` --- - -CREATE TABLE `rc_users` ( - `user_id` int(10) UNSIGNED NOT NULL, - `username` varchar(128) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, - `mail_host` varchar(128) NOT NULL, - `created` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', - `last_login` datetime DEFAULT NULL, - `failed_login` datetime DEFAULT NULL, - `failed_login_counter` int(10) UNSIGNED DEFAULT NULL, - `language` varchar(5) DEFAULT NULL, - `preferences` longtext DEFAULT NULL -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE DATABASE IF NOT EXISTS `vmail` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci; +USE `vmail`; -- -------------------------------------------------------- @@ -339,89 +22,133 @@ CREATE TABLE `rc_users` ( -- Table structure for table `sa_userpref` -- -CREATE TABLE `sa_userpref` ( +CREATE TABLE IF NOT EXISTS `sa_userpref` ( `username` varchar(255) NOT NULL DEFAULT '', `preference` varchar(50) NOT NULL DEFAULT '', `value` varchar(100) NOT NULL DEFAULT '', - `prefid` int(11) NOT NULL + `prefid` int(11) NOT NULL AUTO_INCREMENT, + PRIMARY KEY (`prefid`), + KEY `username` (`username`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- +-- RELATIONSHIPS FOR TABLE `sa_userpref`: +-- + -- -------------------------------------------------------- -- -- Table structure for table `vm_aliases` -- -CREATE TABLE `vm_aliases` ( - `id` int(10) UNSIGNED NOT NULL, +CREATE TABLE IF NOT EXISTS `vm_aliases` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `mbox_id` int(10) UNSIGNED NOT NULL, - `alias` varchar(128) NOT NULL + `alias` varchar(128) NOT NULL, + PRIMARY KEY (`id`), + KEY `mbox_delete_aliases` (`mbox_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- +-- RELATIONSHIPS FOR TABLE `vm_aliases`: +-- `mbox_id` +-- `vm_mboxes` -> `id` +-- + -- -------------------------------------------------------- -- -- Table structure for table `vm_autoresponders` -- -CREATE TABLE `vm_autoresponders` ( - `id` int(10) UNSIGNED NOT NULL, +CREATE TABLE IF NOT EXISTS `vm_autoresponders` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `mbox_id` int(10) UNSIGNED NOT NULL, `subject` varchar(128) NOT NULL, `body` text NOT NULL, `mode` enum('Vacation','Autoresponder') NOT NULL, `status` tinyint(1) NOT NULL DEFAULT 1, `start` datetime DEFAULT NULL, - `end` datetime DEFAULT NULL + `end` datetime DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `autoresponder` (`mbox_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- +-- RELATIONSHIPS FOR TABLE `vm_autoresponders`: +-- `mbox_id` +-- `vm_mboxes` -> `id` +-- + -- -------------------------------------------------------- -- -- Table structure for table `vm_domains` -- -CREATE TABLE `vm_domains` ( - `id` int(11) UNSIGNED NOT NULL, +CREATE TABLE IF NOT EXISTS `vm_domains` ( + `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT, `domain` varchar(255) NOT NULL, `status` tinyint(1) NOT NULL DEFAULT 1 COMMENT '1 for enabled, 0 for disabled', `mbox_limit` smallint(6) UNSIGNED DEFAULT NULL COMMENT 'Maximum number of mailboxes for this domain', - `mbox_quota_default` smallint(6) UNSIGNED DEFAULT NULL COMMENT 'Default mailbox quota in GB' + `mbox_quota_default` smallint(6) UNSIGNED DEFAULT NULL COMMENT 'Default mailbox quota in GB', + PRIMARY KEY (`id`), + KEY `domain` (`domain`(191)) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- +-- RELATIONSHIPS FOR TABLE `vm_domains`: +-- + -- -------------------------------------------------------- -- -- Table structure for table `vm_filters` -- -CREATE TABLE `vm_filters` ( - `id` int(10) UNSIGNED NOT NULL, +CREATE TABLE IF NOT EXISTS `vm_filters` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `mbox_id` int(11) UNSIGNED NOT NULL, - `filter` text NOT NULL + `filter` text NOT NULL, + PRIMARY KEY (`id`), + KEY `mbox_delete_filters` (`mbox_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- +-- RELATIONSHIPS FOR TABLE `vm_filters`: +-- `mbox_id` +-- `vm_mboxes` -> `id` +-- + -- -------------------------------------------------------- -- -- Table structure for table `vm_forwards` -- -CREATE TABLE `vm_forwards` ( - `id` int(10) UNSIGNED NOT NULL, +CREATE TABLE IF NOT EXISTS `vm_forwards` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `mbox_id` int(10) UNSIGNED NOT NULL, `forward_to` varchar(128) NOT NULL, - `save_local` tinyint(1) NOT NULL DEFAULT 0 + `save_local` tinyint(1) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`), + UNIQUE KEY `mbox_id` (`mbox_id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- +-- RELATIONSHIPS FOR TABLE `vm_forwards`: +-- `mbox_id` +-- `vm_mboxes` -> `id` +-- + -- -------------------------------------------------------- -- -- Table structure for table `vm_greylisting` -- -CREATE TABLE `vm_greylisting` ( - `id` bigint(20) UNSIGNED NOT NULL, +CREATE TABLE IF NOT EXISTS `vm_greylisting` ( + `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT, `relay_hostname` varchar(255) DEFAULT NULL, `relay_ip` varchar(80) DEFAULT NULL, `sender` varchar(255) DEFAULT NULL, @@ -432,486 +159,59 @@ CREATE TABLE `vm_greylisting` ( `create_time` datetime NOT NULL DEFAULT '1000-01-01 00:00:00', `type` enum('AUTO','MANUAL') NOT NULL DEFAULT 'MANUAL', `passcount` bigint(20) NOT NULL DEFAULT 0, - `blockcount` bigint(20) NOT NULL DEFAULT 0 + `blockcount` bigint(20) NOT NULL DEFAULT 0, + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- +-- RELATIONSHIPS FOR TABLE `vm_greylisting`: +-- + -- -------------------------------------------------------- -- -- Table structure for table `vm_greylisting_resenders` -- -CREATE TABLE `vm_greylisting_resenders` ( - `id` bigint(20) NOT NULL, +CREATE TABLE IF NOT EXISTS `vm_greylisting_resenders` ( + `id` bigint(20) NOT NULL AUTO_INCREMENT, `hostname` varchar(255) NOT NULL, `count` bigint(20) UNSIGNED NOT NULL DEFAULT 1, - `timestamp` timestamp NOT NULL DEFAULT current_timestamp() + `timestamp` timestamp NOT NULL DEFAULT current_timestamp(), + PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- +-- RELATIONSHIPS FOR TABLE `vm_greylisting_resenders`: +-- + -- -------------------------------------------------------- -- -- Table structure for table `vm_mboxes` -- -CREATE TABLE `vm_mboxes` ( - `id` int(10) UNSIGNED NOT NULL, +CREATE TABLE IF NOT EXISTS `vm_mboxes` ( + `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, `domain_id` int(10) UNSIGNED NOT NULL, `mbox` varchar(128) NOT NULL, `passwd` char(128) NOT NULL, `status` tinyint(1) NOT NULL DEFAULT 1, - `quota` int(10) UNSIGNED DEFAULT NULL + `quota` int(10) UNSIGNED DEFAULT NULL, + PRIMARY KEY (`id`), + KEY `email` (`domain_id`,`mbox`) USING BTREE ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; -- --- Indexes for dumped tables +-- RELATIONSHIPS FOR TABLE `vm_mboxes`: +-- `domain_id` +-- `vm_domains` -> `id` -- --- --- Indexes for table `rc_cache` --- -ALTER TABLE `rc_cache` - ADD PRIMARY KEY (`user_id`,`cache_key`), - ADD KEY `expires_index` (`expires`); - --- --- Indexes for table `rc_cache_index` --- -ALTER TABLE `rc_cache_index` - ADD PRIMARY KEY (`user_id`,`mailbox`), - ADD KEY `expires_index` (`expires`); - --- --- Indexes for table `rc_cache_messages` --- -ALTER TABLE `rc_cache_messages` - ADD PRIMARY KEY (`user_id`,`mailbox`,`uid`), - ADD KEY `expires_index` (`expires`); - --- --- Indexes for table `rc_cache_shared` --- -ALTER TABLE `rc_cache_shared` - ADD PRIMARY KEY (`cache_key`), - ADD KEY `expires_index` (`expires`); - --- --- Indexes for table `rc_cache_thread` --- -ALTER TABLE `rc_cache_thread` - ADD PRIMARY KEY (`user_id`,`mailbox`), - ADD KEY `expires_index` (`expires`); - --- --- Indexes for table `rc_carddav_addressbooks` --- -ALTER TABLE `rc_carddav_addressbooks` - ADD PRIMARY KEY (`id`), - ADD KEY `user_id` (`user_id`) USING BTREE; - --- --- Indexes for table `rc_carddav_contacts` --- -ALTER TABLE `rc_carddav_contacts` - ADD PRIMARY KEY (`id`), - ADD UNIQUE KEY `cuid` (`cuid`(191),`abook_id`) USING BTREE, - ADD UNIQUE KEY `uri` (`uri`(191),`abook_id`) USING BTREE, - ADD KEY `abook_id` (`abook_id`); - --- --- Indexes for table `rc_carddav_groups` --- -ALTER TABLE `rc_carddav_groups` - ADD PRIMARY KEY (`id`), - ADD UNIQUE KEY `cuid` (`cuid`(191),`abook_id`) USING BTREE, - ADD UNIQUE KEY `uri` (`uri`(191),`abook_id`) USING BTREE, - ADD KEY `abook_id` (`abook_id`); - --- --- Indexes for table `rc_carddav_group_user` --- -ALTER TABLE `rc_carddav_group_user` - ADD PRIMARY KEY (`group_id`,`contact_id`), - ADD KEY `contact_id` (`contact_id`); - --- --- Indexes for table `rc_carddav_migrations` --- -ALTER TABLE `rc_carddav_migrations` - ADD PRIMARY KEY (`ID`), - ADD UNIQUE KEY `filename` (`filename`); - --- --- Indexes for table `rc_carddav_xsubtypes` --- -ALTER TABLE `rc_carddav_xsubtypes` - ADD PRIMARY KEY (`id`), - ADD UNIQUE KEY `typename` (`typename`,`subtype`,`abook_id`), - ADD KEY `abook_id` (`abook_id`); - --- --- Indexes for table `rc_contactgroupmembers` --- -ALTER TABLE `rc_contactgroupmembers` - ADD PRIMARY KEY (`contactgroup_id`,`contact_id`), - ADD KEY `contactgroupmembers_contact_index` (`contact_id`); - --- --- Indexes for table `rc_contactgroups` --- -ALTER TABLE `rc_contactgroups` - ADD PRIMARY KEY (`contactgroup_id`), - ADD KEY `contactgroups_user_index` (`user_id`,`del`); - --- --- Indexes for table `rc_contacts` --- -ALTER TABLE `rc_contacts` - ADD PRIMARY KEY (`contact_id`), - ADD KEY `user_contacts_index` (`user_id`,`del`); - --- --- Indexes for table `rc_dictionary` --- -ALTER TABLE `rc_dictionary` - ADD PRIMARY KEY (`id`), - ADD UNIQUE KEY `uniqueness` (`user_id`,`language`); - --- --- Indexes for table `rc_filestore` --- -ALTER TABLE `rc_filestore` - ADD PRIMARY KEY (`file_id`), - ADD UNIQUE KEY `uniqueness` (`user_id`,`context`,`filename`); - --- --- Indexes for table `rc_identities` --- -ALTER TABLE `rc_identities` - ADD PRIMARY KEY (`identity_id`), - ADD KEY `user_identities_index` (`user_id`,`del`), - ADD KEY `email_identities_index` (`email`,`del`); - --- --- Indexes for table `rc_searches` --- -ALTER TABLE `rc_searches` - ADD PRIMARY KEY (`search_id`), - ADD UNIQUE KEY `uniqueness` (`user_id`,`type`,`name`); - --- --- Indexes for table `rc_session` --- -ALTER TABLE `rc_session` - ADD PRIMARY KEY (`sess_id`), - ADD KEY `changed_index` (`changed`); - --- --- Indexes for table `rc_system` --- -ALTER TABLE `rc_system` - ADD PRIMARY KEY (`name`); - --- --- Indexes for table `rc_users` --- -ALTER TABLE `rc_users` - ADD PRIMARY KEY (`user_id`), - ADD UNIQUE KEY `username` (`username`,`mail_host`); - --- --- Indexes for table `sa_userpref` --- -ALTER TABLE `sa_userpref` - ADD PRIMARY KEY (`prefid`), - ADD KEY `username` (`username`(191)); - --- --- Indexes for table `vm_aliases` --- -ALTER TABLE `vm_aliases` - ADD PRIMARY KEY (`id`), - ADD KEY `mbox_delete_aliases` (`mbox_id`); - --- --- Indexes for table `vm_autoresponders` --- -ALTER TABLE `vm_autoresponders` - ADD PRIMARY KEY (`id`), - ADD UNIQUE KEY `autoresponder` (`mbox_id`); - --- --- Indexes for table `vm_domains` --- -ALTER TABLE `vm_domains` - ADD PRIMARY KEY (`id`), - ADD KEY `domain` (`domain`(191)); - --- --- Indexes for table `vm_filters` --- -ALTER TABLE `vm_filters` - ADD PRIMARY KEY (`id`), - ADD KEY `mbox_delete_filters` (`mbox_id`); - --- --- Indexes for table `vm_forwards` --- -ALTER TABLE `vm_forwards` - ADD PRIMARY KEY (`id`), - ADD UNIQUE KEY `mbox_id` (`mbox_id`); - --- --- Indexes for table `vm_greylisting` --- -ALTER TABLE `vm_greylisting` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `vm_greylisting_resenders` --- -ALTER TABLE `vm_greylisting_resenders` - ADD PRIMARY KEY (`id`); - --- --- Indexes for table `vm_mboxes` --- -ALTER TABLE `vm_mboxes` - ADD PRIMARY KEY (`id`), - ADD KEY `email` (`domain_id`,`mbox`) USING BTREE; - --- --- AUTO_INCREMENT for dumped tables --- - --- --- AUTO_INCREMENT for table `rc_carddav_addressbooks` --- -ALTER TABLE `rc_carddav_addressbooks` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_carddav_contacts` --- -ALTER TABLE `rc_carddav_contacts` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_carddav_groups` --- -ALTER TABLE `rc_carddav_groups` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_carddav_migrations` --- -ALTER TABLE `rc_carddav_migrations` - MODIFY `ID` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_carddav_xsubtypes` --- -ALTER TABLE `rc_carddav_xsubtypes` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_contactgroups` --- -ALTER TABLE `rc_contactgroups` - MODIFY `contactgroup_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_contacts` --- -ALTER TABLE `rc_contacts` - MODIFY `contact_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_dictionary` --- -ALTER TABLE `rc_dictionary` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_filestore` --- -ALTER TABLE `rc_filestore` - MODIFY `file_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_identities` --- -ALTER TABLE `rc_identities` - MODIFY `identity_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_searches` --- -ALTER TABLE `rc_searches` - MODIFY `search_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `rc_users` --- -ALTER TABLE `rc_users` - MODIFY `user_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `sa_userpref` --- -ALTER TABLE `sa_userpref` - MODIFY `prefid` int(11) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vm_aliases` --- -ALTER TABLE `vm_aliases` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vm_autoresponders` --- -ALTER TABLE `vm_autoresponders` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vm_domains` --- -ALTER TABLE `vm_domains` - MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vm_filters` --- -ALTER TABLE `vm_filters` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vm_forwards` --- -ALTER TABLE `vm_forwards` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vm_greylisting` --- -ALTER TABLE `vm_greylisting` - MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vm_greylisting_resenders` --- -ALTER TABLE `vm_greylisting_resenders` - MODIFY `id` bigint(20) NOT NULL AUTO_INCREMENT; - --- --- AUTO_INCREMENT for table `vm_mboxes` --- -ALTER TABLE `vm_mboxes` - MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT; - -- -- Constraints for dumped tables -- --- --- Constraints for table `rc_cache` --- -ALTER TABLE `rc_cache` - ADD CONSTRAINT `user_id_fk_cache` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_cache_index` --- -ALTER TABLE `rc_cache_index` - ADD CONSTRAINT `user_id_fk_cache_index` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_cache_messages` --- -ALTER TABLE `rc_cache_messages` - ADD CONSTRAINT `user_id_fk_cache_messages` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_cache_thread` --- -ALTER TABLE `rc_cache_thread` - ADD CONSTRAINT `user_id_fk_cache_thread` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_carddav_addressbooks` --- -ALTER TABLE `rc_carddav_addressbooks` - ADD CONSTRAINT `rc_carddav_addressbooks_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_carddav_contacts` --- -ALTER TABLE `rc_carddav_contacts` - ADD CONSTRAINT `rc_carddav_contacts_ibfk_1` FOREIGN KEY (`abook_id`) REFERENCES `rc_carddav_addressbooks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_carddav_groups` --- -ALTER TABLE `rc_carddav_groups` - ADD CONSTRAINT `rc_carddav_groups_ibfk_1` FOREIGN KEY (`abook_id`) REFERENCES `rc_carddav_addressbooks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_carddav_group_user` --- -ALTER TABLE `rc_carddav_group_user` - ADD CONSTRAINT `rc_carddav_group_user_ibfk_1` FOREIGN KEY (`group_id`) REFERENCES `rc_carddav_groups` (`id`) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT `rc_carddav_group_user_ibfk_2` FOREIGN KEY (`contact_id`) REFERENCES `rc_carddav_contacts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_carddav_xsubtypes` --- -ALTER TABLE `rc_carddav_xsubtypes` - ADD CONSTRAINT `rc_carddav_xsubtypes_ibfk_1` FOREIGN KEY (`abook_id`) REFERENCES `rc_carddav_addressbooks` (`id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_contactgroupmembers` --- -ALTER TABLE `rc_contactgroupmembers` - ADD CONSTRAINT `contact_id_fk_contacts` FOREIGN KEY (`contact_id`) REFERENCES `rc_contacts` (`contact_id`) ON DELETE CASCADE ON UPDATE CASCADE, - ADD CONSTRAINT `contactgroup_id_fk_contactgroups` FOREIGN KEY (`contactgroup_id`) REFERENCES `rc_contactgroups` (`contactgroup_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_contactgroups` --- -ALTER TABLE `rc_contactgroups` - ADD CONSTRAINT `user_id_fk_contactgroups` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_contacts` --- -ALTER TABLE `rc_contacts` - ADD CONSTRAINT `user_id_fk_contacts` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_dictionary` --- -ALTER TABLE `rc_dictionary` - ADD CONSTRAINT `user_id_fk_dictionary` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_filestore` --- -ALTER TABLE `rc_filestore` - ADD CONSTRAINT `user_id_fk_filestore` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_identities` --- -ALTER TABLE `rc_identities` - ADD CONSTRAINT `user_id_fk_identities` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - --- --- Constraints for table `rc_searches` --- -ALTER TABLE `rc_searches` - ADD CONSTRAINT `user_id_fk_searches` FOREIGN KEY (`user_id`) REFERENCES `rc_users` (`user_id`) ON DELETE CASCADE ON UPDATE CASCADE; - -- -- Constraints for table `vm_aliases` --