Hi Paul

please let us know if you think this part in HEAD should
work finally for testings and verify

it happened twice to me that i built HEAD instead 3.1-tree by
my own stupidity on the testserver and some chnages where done
to the users-table and a view others but not finally and 3.2/HEAD
was not happy with the result

not that i plan to jump to 3.2 this time as early tester
in prodcution, but i can help with my testserver on VMware
and snapshot/roolback/update/rollback/update a lot :-)
________________________________________

maybe because i have at least one own column "client_idnr"
which i need to maintain my domain-mapping with a seperate
table because my backends and scripts are domain-centric

however - attached my current scheme of all 7 dbmail machines
in from of a phpMyAdmin dump - all machines at least are identical
verified by diff and maybe we should take care in this process
that users have a predictable way to verify their existing scheme
against what the future auto-migration expects at the first run



-- phpMyAdmin SQL Dump
-- version 4.0.5
-- http://www.phpmyadmin.net
--
-- Host: 127.0.0.1:3307
-- Erstellungszeit: 06. Sep 2013 um 11:32
-- Server Version: 5.5.33
-- PHP-Version: 5.5.3

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- Datenbank: `dbmail`
--

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_acl`
--

DROP TABLE IF EXISTS `dbmail_acl`;
CREATE TABLE IF NOT EXISTS `dbmail_acl` (
  `user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `mailbox_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `lookup_flag` tinyint(1) NOT NULL DEFAULT '0',
  `read_flag` tinyint(1) NOT NULL DEFAULT '0',
  `seen_flag` tinyint(1) NOT NULL DEFAULT '0',
  `write_flag` tinyint(1) NOT NULL DEFAULT '0',
  `insert_flag` tinyint(1) NOT NULL DEFAULT '0',
  `post_flag` tinyint(1) NOT NULL DEFAULT '0',
  `create_flag` tinyint(1) NOT NULL DEFAULT '0',
  `delete_flag` tinyint(1) NOT NULL DEFAULT '0',
  `administer_flag` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_flag` tinyint(1) NOT NULL DEFAULT '0',
  `expunge_flag` tinyint(1) NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_id`,`mailbox_id`),
  KEY `user_id_index` (`user_id`),
  KEY `mailbox_id_index` (`mailbox_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_aliases`
--

DROP TABLE IF EXISTS `dbmail_aliases`;
CREATE TABLE IF NOT EXISTS `dbmail_aliases` (
  `alias_idnr` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `alias` varchar(255) NOT NULL DEFAULT '',
  `deliver_to` varchar(255) NOT NULL DEFAULT '',
  `client_idnr` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`alias_idnr`),
  UNIQUE KEY `alias` (`alias`,`deliver_to`),
  KEY `alias_index` (`alias`),
  KEY `client_idnr_index` (`client_idnr`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=1097 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_authlog`
--

DROP TABLE IF EXISTS `dbmail_authlog`;
CREATE TABLE IF NOT EXISTS `dbmail_authlog` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `userid` varchar(100) DEFAULT NULL,
  `service` varchar(32) DEFAULT NULL,
  `login_time` datetime DEFAULT NULL,
  `logout_time` datetime DEFAULT NULL,
  `src_ip` varchar(16) DEFAULT NULL,
  `src_port` int(11) DEFAULT NULL,
  `dst_ip` varchar(16) DEFAULT NULL,
  `dst_port` int(11) DEFAULT NULL,
  `status` varchar(32) DEFAULT 'active',
  `bytes_rx` bigint(20) NOT NULL DEFAULT '0',
  `bytes_tx` bigint(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_auto_notifications`
--

DROP TABLE IF EXISTS `dbmail_auto_notifications`;
CREATE TABLE IF NOT EXISTS `dbmail_auto_notifications` (
  `user_idnr` bigint(20) unsigned NOT NULL DEFAULT '0',
  `notify_address` varchar(100) NOT NULL DEFAULT '',
  KEY `user_idnr_index` (`user_idnr`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_auto_replies`
--

DROP TABLE IF EXISTS `dbmail_auto_replies`;
CREATE TABLE IF NOT EXISTS `dbmail_auto_replies` (
  `user_idnr` bigint(20) unsigned NOT NULL DEFAULT '0',
  `start_date` datetime NOT NULL,
  `stop_date` datetime NOT NULL,
  `reply_body` mediumtext,
  KEY `user_idnr_index` (`user_idnr`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Stellvertreter-Struktur des Views `dbmail_ccfield`
--
DROP VIEW IF EXISTS `dbmail_ccfield`;
CREATE TABLE IF NOT EXISTS `dbmail_ccfield` (
`physmessage_id` bigint(20) unsigned
,`ccfield` varchar(255)
);
-- --------------------------------------------------------

--
-- Stellvertreter-Struktur des Views `dbmail_datefield`
--
DROP VIEW IF EXISTS `dbmail_datefield`;
CREATE TABLE IF NOT EXISTS `dbmail_datefield` (
`physmessage_id` bigint(20) unsigned
,`datefield` datetime
,`sortfield` varchar(255)
);
-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_envelope`
--

DROP TABLE IF EXISTS `dbmail_envelope`;
CREATE TABLE IF NOT EXISTS `dbmail_envelope` (
  `physmessage_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `envelope` text NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `physmessage_id_1` (`physmessage_id`),
  UNIQUE KEY `physmessage_id_2` (`physmessage_id`,`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=40734 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_filters`
--

DROP TABLE IF EXISTS `dbmail_filters`;
CREATE TABLE IF NOT EXISTS `dbmail_filters` (
  `user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `headername` varchar(255) NOT NULL,
  `headervalue` varchar(255) NOT NULL,
  `mailbox` varchar(255) NOT NULL,
  PRIMARY KEY (`id`),
  KEY `dbmail_filters_ibfk_1` (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Stellvertreter-Struktur des Views `dbmail_fromfield`
--
DROP VIEW IF EXISTS `dbmail_fromfield`;
CREATE TABLE IF NOT EXISTS `dbmail_fromfield` (
`physmessage_id` bigint(20) unsigned
,`fromfield` varchar(255)
);
-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_header`
--

DROP TABLE IF EXISTS `dbmail_header`;
CREATE TABLE IF NOT EXISTS `dbmail_header` (
  `physmessage_id` bigint(20) unsigned NOT NULL,
  `headername_id` bigint(20) unsigned NOT NULL,
  `headervalue_id` bigint(20) unsigned NOT NULL,
  PRIMARY KEY (`physmessage_id`,`headername_id`,`headervalue_id`),
  KEY `physmessage_id` (`physmessage_id`),
  KEY `headername_id` (`headername_id`),
  KEY `headervalue_id` (`headervalue_id`),
  KEY `physmessage_id_headername_id` (`physmessage_id`,`headername_id`),
  KEY `physmessage_id_headervalue_id` (`physmessage_id`,`headervalue_id`),
  KEY `headername_id_headervalue_id` (`headername_id`,`headervalue_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_headername`
--

DROP TABLE IF EXISTS `dbmail_headername`;
CREATE TABLE IF NOT EXISTS `dbmail_headername` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `headername` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  UNIQUE KEY `headername` (`headername`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=214 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_headervalue`
--

DROP TABLE IF EXISTS `dbmail_headervalue`;
CREATE TABLE IF NOT EXISTS `dbmail_headervalue` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `hash` varchar(255) NOT NULL,
  `headervalue` text NOT NULL,
  `sortfield` varchar(255) DEFAULT NULL,
  `datefield` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `hash` (`hash`),
  KEY `headervalue` (`headervalue`(255)),
  KEY `sortfield` (`sortfield`),
  KEY `datefield` (`datefield`),
  KEY `hash_headervalue` (`hash`,`headervalue`(255))
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=26945 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_keywords`
--

DROP TABLE IF EXISTS `dbmail_keywords`;
CREATE TABLE IF NOT EXISTS `dbmail_keywords` (
  `message_idnr` bigint(20) unsigned NOT NULL DEFAULT '0',
  `keyword` varchar(255) NOT NULL,
  PRIMARY KEY (`message_idnr`,`keyword`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_mailboxes`
--

DROP TABLE IF EXISTS `dbmail_mailboxes`;
CREATE TABLE IF NOT EXISTS `dbmail_mailboxes` (
  `mailbox_idnr` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `owner_idnr` bigint(20) unsigned NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL DEFAULT '',
  `seen_flag` tinyint(1) NOT NULL DEFAULT '0',
  `answered_flag` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_flag` tinyint(1) NOT NULL DEFAULT '0',
  `flagged_flag` tinyint(1) NOT NULL DEFAULT '0',
  `recent_flag` tinyint(1) NOT NULL DEFAULT '0',
  `draft_flag` tinyint(1) NOT NULL DEFAULT '0',
  `no_inferiors` tinyint(1) NOT NULL DEFAULT '0',
  `no_select` tinyint(1) NOT NULL DEFAULT '0',
  `permission` tinyint(1) DEFAULT '2',
  `seq` bigint(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`mailbox_idnr`),
  UNIQUE KEY `owner_idnr_name_index` (`owner_idnr`,`name`),
  KEY `name_index` (`name`),
  KEY `owner_idnr_index` (`owner_idnr`),
  KEY `seq_index` (`seq`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=106 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_messages`
--

DROP TABLE IF EXISTS `dbmail_messages`;
CREATE TABLE IF NOT EXISTS `dbmail_messages` (
  `message_idnr` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `mailbox_idnr` bigint(20) unsigned NOT NULL DEFAULT '0',
  `physmessage_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `seen_flag` tinyint(1) NOT NULL DEFAULT '0',
  `answered_flag` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_flag` tinyint(1) NOT NULL DEFAULT '0',
  `flagged_flag` tinyint(1) NOT NULL DEFAULT '0',
  `recent_flag` tinyint(1) NOT NULL DEFAULT '0',
  `draft_flag` tinyint(1) NOT NULL DEFAULT '0',
  `unique_id` varchar(70) NOT NULL DEFAULT '',
  `status` tinyint(3) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`message_idnr`),
  KEY `physmessage_id_index` (`physmessage_id`),
  KEY `mailbox_idnr_index` (`mailbox_idnr`),
  KEY `seen_flag_index` (`seen_flag`),
  KEY `unique_id_index` (`unique_id`),
  KEY `status_index` (`status`),
  KEY `deleted_flag_index` (`deleted_flag`),
  KEY `mailbox_status` (`mailbox_idnr`,`status`,`seen_flag`,`recent_flag`),
  KEY `unique_seen_index` (`physmessage_id`,`seen_flag`,`unique_id`),
  KEY `status_mailbox_index` (`physmessage_id`,`mailbox_idnr`,`status`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=216306 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_mimeparts`
--

DROP TABLE IF EXISTS `dbmail_mimeparts`;
CREATE TABLE IF NOT EXISTS `dbmail_mimeparts` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `hash` char(128) NOT NULL,
  `data` longblob NOT NULL,
  `size` bigint(20) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`),
  KEY `hash` (`hash`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=37560 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_partlists`
--

DROP TABLE IF EXISTS `dbmail_partlists`;
CREATE TABLE IF NOT EXISTS `dbmail_partlists` (
  `physmessage_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `is_header` tinyint(1) NOT NULL DEFAULT '0',
  `part_key` smallint(6) NOT NULL DEFAULT '0',
  `part_depth` smallint(6) NOT NULL DEFAULT '0',
  `part_order` smallint(6) NOT NULL DEFAULT '0',
  `part_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  UNIQUE KEY `message_parts` (`physmessage_id`,`part_key`,`part_depth`,`part_order`),
  KEY `physmessage_id` (`physmessage_id`),
  KEY `part_id` (`part_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_pbsp`
--

DROP TABLE IF EXISTS `dbmail_pbsp`;
CREATE TABLE IF NOT EXISTS `dbmail_pbsp` (
  `idnr` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `since` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `ipnumber` varchar(40) NOT NULL,
  PRIMARY KEY (`idnr`),
  UNIQUE KEY `ipnumber_index` (`ipnumber`),
  KEY `since_index` (`since`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=1 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_physmessage`
--

DROP TABLE IF EXISTS `dbmail_physmessage`;
CREATE TABLE IF NOT EXISTS `dbmail_physmessage` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `messagesize` bigint(20) unsigned NOT NULL DEFAULT '0',
  `rfcsize` bigint(20) unsigned NOT NULL DEFAULT '0',
  `internal_date` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=45705 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_referencesfield`
--

DROP TABLE IF EXISTS `dbmail_referencesfield`;
CREATE TABLE IF NOT EXISTS `dbmail_referencesfield` (
  `physmessage_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `referencesfield` varchar(255) NOT NULL DEFAULT '',
  PRIMARY KEY (`id`),
  UNIQUE KEY `physmessage_id` (`physmessage_id`,`referencesfield`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=66 ;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_replycache`
--

DROP TABLE IF EXISTS `dbmail_replycache`;
CREATE TABLE IF NOT EXISTS `dbmail_replycache` (
  `to_addr` varchar(255) NOT NULL DEFAULT '',
  `from_addr` varchar(255) NOT NULL DEFAULT '',
  `handle` varchar(255) NOT NULL DEFAULT '',
  `lastseen` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  UNIQUE KEY `replycache_1` (`to_addr`,`from_addr`,`handle`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_sievescripts`
--

DROP TABLE IF EXISTS `dbmail_sievescripts`;
CREATE TABLE IF NOT EXISTS `dbmail_sievescripts` (
  `owner_idnr` bigint(20) unsigned NOT NULL DEFAULT '0',
  `name` varchar(255) NOT NULL,
  `script` text,
  `active` tinyint(1) NOT NULL DEFAULT '0',
  UNIQUE KEY `owner_idnr` (`owner_idnr`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Stellvertreter-Struktur des Views `dbmail_subjectfield`
--
DROP VIEW IF EXISTS `dbmail_subjectfield`;
CREATE TABLE IF NOT EXISTS `dbmail_subjectfield` (
`physmessage_id` bigint(20) unsigned
,`subjectfield` text
);
-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_subscription`
--

DROP TABLE IF EXISTS `dbmail_subscription`;
CREATE TABLE IF NOT EXISTS `dbmail_subscription` (
  `user_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  `mailbox_id` bigint(20) unsigned NOT NULL DEFAULT '0',
  PRIMARY KEY (`user_id`,`mailbox_id`),
  KEY `user_id_index` (`user_id`),
  KEY `mailbox_id_index` (`mailbox_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Stellvertreter-Struktur des Views `dbmail_tofield`
--
DROP VIEW IF EXISTS `dbmail_tofield`;
CREATE TABLE IF NOT EXISTS `dbmail_tofield` (
`physmessage_id` bigint(20) unsigned
,`tofield` varchar(255)
);
-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_usermap`
--

DROP TABLE IF EXISTS `dbmail_usermap`;
CREATE TABLE IF NOT EXISTS `dbmail_usermap` (
  `login` varchar(255) NOT NULL,
  `sock_allow` varchar(255) NOT NULL,
  `sock_deny` varchar(255) NOT NULL,
  `userid` varchar(255) NOT NULL,
  UNIQUE KEY `usermap_idx_1` (`login`,`sock_allow`,`userid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED;

-- --------------------------------------------------------

--
-- Tabellenstruktur für Tabelle `dbmail_users`
--

DROP TABLE IF EXISTS `dbmail_users`;
CREATE TABLE IF NOT EXISTS `dbmail_users` (
  `user_idnr` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `userid` varchar(255) NOT NULL DEFAULT '',
  `passwd` varchar(255) NOT NULL DEFAULT '',
  `client_idnr` bigint(20) unsigned NOT NULL DEFAULT '0',
  `maxmail_size` bigint(20) NOT NULL DEFAULT '0',
  `curmail_size` bigint(20) NOT NULL DEFAULT '0',
  `maxsieve_size` bigint(20) NOT NULL DEFAULT '0',
  `cursieve_size` bigint(20) NOT NULL DEFAULT '0',
  `encryption_type` varchar(255) NOT NULL DEFAULT '',
  `last_login` datetime NOT NULL DEFAULT '1979-11-03 22:05:58',
  `user_realname` varchar(128) NOT NULL DEFAULT '',
  PRIMARY KEY (`user_idnr`),
  UNIQUE KEY `userid_index` (`userid`),
  KEY `client_idnr` (`client_idnr`)
) ENGINE=InnoDB  DEFAULT CHARSET=utf8 ROW_FORMAT=COMPRESSED AUTO_INCREMENT=53 ;

-- --------------------------------------------------------

--
-- Struktur des Views `dbmail_ccfield`
--
DROP TABLE IF EXISTS `dbmail_ccfield`;

CREATE ALGORITHM=UNDEFINED DEFINER=`dbmail`@`localhost` SQL SECURITY DEFINER VIEW `dbmail_ccfield` AS select `m`.`physmessage_id` AS `physmessage_id`,`v`.`sortfield` AS `ccfield` from (((`dbmail_messages` `m` join `dbmail_header` `h` on((`m`.`physmessage_id` = `h`.`physmessage_id`))) join `dbmail_headername` `n` on((`h`.`headername_id` = `n`.`id`))) join `dbmail_headervalue` `v` on((`h`.`headervalue_id` = `v`.`id`))) where (`n`.`headername` = 'cc');

-- --------------------------------------------------------

--
-- Struktur des Views `dbmail_datefield`
--
DROP TABLE IF EXISTS `dbmail_datefield`;

CREATE ALGORITHM=UNDEFINED DEFINER=`dbmail`@`localhost` SQL SECURITY DEFINER VIEW `dbmail_datefield` AS select `m`.`physmessage_id` AS `physmessage_id`,`v`.`datefield` AS `datefield`,`v`.`sortfield` AS `sortfield` from (((`dbmail_messages` `m` join `dbmail_header` `h` on((`m`.`physmessage_id` = `h`.`physmessage_id`))) join `dbmail_headername` `n` on((`h`.`headername_id` = `n`.`id`))) join `dbmail_headervalue` `v` on((`h`.`headervalue_id` = `v`.`id`))) where (`n`.`headername` = 'date');

-- --------------------------------------------------------

--
-- Struktur des Views `dbmail_fromfield`
--
DROP TABLE IF EXISTS `dbmail_fromfield`;

CREATE ALGORITHM=UNDEFINED DEFINER=`dbmail`@`localhost` SQL SECURITY DEFINER VIEW `dbmail_fromfield` AS select `m`.`physmessage_id` AS `physmessage_id`,`v`.`sortfield` AS `fromfield` from (((`dbmail_messages` `m` join `dbmail_header` `h` on((`m`.`physmessage_id` = `h`.`physmessage_id`))) join `dbmail_headername` `n` on((`h`.`headername_id` = `n`.`id`))) join `dbmail_headervalue` `v` on((`h`.`headervalue_id` = `v`.`id`))) where (`n`.`headername` = 'from');

-- --------------------------------------------------------

--
-- Struktur des Views `dbmail_subjectfield`
--
DROP TABLE IF EXISTS `dbmail_subjectfield`;

CREATE ALGORITHM=UNDEFINED DEFINER=`dbmail`@`localhost` SQL SECURITY DEFINER VIEW `dbmail_subjectfield` AS select `m`.`physmessage_id` AS `physmessage_id`,`v`.`headervalue` AS `subjectfield` from (((`dbmail_messages` `m` join `dbmail_header` `h` on((`m`.`physmessage_id` = `h`.`physmessage_id`))) join `dbmail_headername` `n` on((`h`.`headername_id` = `n`.`id`))) join `dbmail_headervalue` `v` on((`h`.`headervalue_id` = `v`.`id`))) where (`n`.`headername` = 'subject');

-- --------------------------------------------------------

--
-- Struktur des Views `dbmail_tofield`
--
DROP TABLE IF EXISTS `dbmail_tofield`;

CREATE ALGORITHM=UNDEFINED DEFINER=`dbmail`@`localhost` SQL SECURITY DEFINER VIEW `dbmail_tofield` AS select `m`.`physmessage_id` AS `physmessage_id`,`v`.`sortfield` AS `tofield` from (((`dbmail_messages` `m` join `dbmail_header` `h` on((`m`.`physmessage_id` = `h`.`physmessage_id`))) join `dbmail_headername` `n` on((`h`.`headername_id` = `n`.`id`))) join `dbmail_headervalue` `v` on((`h`.`headervalue_id` = `v`.`id`))) where (`n`.`headername` = 'to');

--
-- Constraints der exportierten Tabellen
--

--
-- Constraints der Tabelle `dbmail_acl`
--
ALTER TABLE `dbmail_acl`
  ADD CONSTRAINT `dbmail_acl_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `dbmail_users` (`user_idnr`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dbmail_acl_ibfk_2` FOREIGN KEY (`mailbox_id`) REFERENCES `dbmail_mailboxes` (`mailbox_idnr`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_auto_notifications`
--
ALTER TABLE `dbmail_auto_notifications`
  ADD CONSTRAINT `dbmail_auto_notifications_ibfk_1` FOREIGN KEY (`user_idnr`) REFERENCES `dbmail_users` (`user_idnr`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_auto_replies`
--
ALTER TABLE `dbmail_auto_replies`
  ADD CONSTRAINT `dbmail_auto_replies_ibfk_1` FOREIGN KEY (`user_idnr`) REFERENCES `dbmail_users` (`user_idnr`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_envelope`
--
ALTER TABLE `dbmail_envelope`
  ADD CONSTRAINT `dbmail_envelope_ibfk_1` FOREIGN KEY (`physmessage_id`) REFERENCES `dbmail_physmessage` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_filters`
--
ALTER TABLE `dbmail_filters`
  ADD CONSTRAINT `dbmail_filters_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `dbmail_users` (`user_idnr`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_header`
--
ALTER TABLE `dbmail_header`
  ADD CONSTRAINT `dbmail_header_ibfk_1` FOREIGN KEY (`physmessage_id`) REFERENCES `dbmail_physmessage` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dbmail_header_ibfk_2` FOREIGN KEY (`headername_id`) REFERENCES `dbmail_headername` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dbmail_header_ibfk_3` FOREIGN KEY (`headervalue_id`) REFERENCES `dbmail_headervalue` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_keywords`
--
ALTER TABLE `dbmail_keywords`
  ADD CONSTRAINT `dbmail_keywords_ibfk_1` FOREIGN KEY (`message_idnr`) REFERENCES `dbmail_messages` (`message_idnr`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_mailboxes`
--
ALTER TABLE `dbmail_mailboxes`
  ADD CONSTRAINT `dbmail_mailboxes_ibfk_1` FOREIGN KEY (`owner_idnr`) REFERENCES `dbmail_users` (`user_idnr`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_messages`
--
ALTER TABLE `dbmail_messages`
  ADD CONSTRAINT `dbmail_messages_ibfk_1` FOREIGN KEY (`physmessage_id`) REFERENCES `dbmail_physmessage` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dbmail_messages_ibfk_2` FOREIGN KEY (`mailbox_idnr`) REFERENCES `dbmail_mailboxes` (`mailbox_idnr`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_partlists`
--
ALTER TABLE `dbmail_partlists`
  ADD CONSTRAINT `dbmail_partlists_ibfk_1` FOREIGN KEY (`physmessage_id`) REFERENCES `dbmail_physmessage` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dbmail_partlists_ibfk_2` FOREIGN KEY (`part_id`) REFERENCES `dbmail_mimeparts` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_referencesfield`
--
ALTER TABLE `dbmail_referencesfield`
  ADD CONSTRAINT `dbmail_referencesfield_ibfk_1` FOREIGN KEY (`physmessage_id`) REFERENCES `dbmail_physmessage` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_sievescripts`
--
ALTER TABLE `dbmail_sievescripts`
  ADD CONSTRAINT `dbmail_sievescripts_ibfk_1` FOREIGN KEY (`owner_idnr`) REFERENCES `dbmail_users` (`user_idnr`) ON DELETE CASCADE ON UPDATE CASCADE;

--
-- Constraints der Tabelle `dbmail_subscription`
--
ALTER TABLE `dbmail_subscription`
  ADD CONSTRAINT `dbmail_subscription_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `dbmail_users` (`user_idnr`) ON DELETE CASCADE ON UPDATE CASCADE,
  ADD CONSTRAINT `dbmail_subscription_ibfk_2` FOREIGN KEY (`mailbox_id`) REFERENCES `dbmail_mailboxes` (`mailbox_idnr`) ON DELETE CASCADE ON UPDATE CASCADE;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
DBmail mailing list
[email protected]
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail

Reply via email to