CREATE TABLE IF NOT EXISTS `aliases` (
  `alias` varchar(64) NOT NULL DEFAULT '',
  `address` varchar(64) NOT NULL DEFAULT '',
  KEY `alias` (`alias`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `aliases` (`alias`, `address`) VALUES('postmaster@domain.tld', 'admin@domain.tld');
INSERT INTO `aliases` (`alias`, `address`) VALUES('hostmaster@domain.tld', 'admin@domain.tld');
INSERT INTO `aliases` (`alias`, `address`) VALUES('abuse@domain.tld', 'admin@domain.tld');
INSERT INTO `aliases` (`alias`, `address`) VALUES('webmaster@domain.tld', 'admin@domain.tld');
INSERT INTO `aliases` (`alias`, `address`) VALUES('root@domain.tld', 'admin@domain.tld');

CREATE TABLE IF NOT EXISTS `passwd` (
  `host` varchar(16) NOT NULL,
  `id` varchar(64) NOT NULL DEFAULT '',
  `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
  `updated` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00' ON UPDATE CURRENT_TIMESTAMP,
  `password` varchar(255) NOT NULL DEFAULT '',
  `name` varchar(64) NOT NULL DEFAULT '',
  `maildir` varchar(255) NOT NULL DEFAULT '',
  `expired` enum('N','Y') NOT NULL DEFAULT 'N',
  `quota_limit_bytes` bigint(20) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `passwd` (`host`, `id`, `created`, `updated`, `password`, `name`, `maildir`, `expired`, `quota_limit_bytes`) VALUES('10.111.0.137', 'admin@domain.tld', '0000-00-00 00:00:00', '2013-07-27 18:33:48', '{MD5}$1$aK$jD/mJjho87tbzpInzEfOb.', 'Victor Ustugov', '/var/vmail/domain.tld/admin', 'N', 15000000000);
INSERT INTO `passwd` (`host`, `id`, `created`, `updated`, `password`, `name`, `maildir`, `expired`, `quota_limit_bytes`) VALUES('10.111.0.169', 'test@domain.tld', '0000-00-00 00:00:00', '2014-11-30 13:01:57', '{MD5}$1$aK$jD/mJjho87tbzpInzEfOb.', 'test', '/var/vmail/domain.tld/test', 'N', 40000);
INSERT INTO `passwd` (`host`, `id`, `created`, `updated`, `password`, `name`, `maildir`, `expired`, `quota_limit_bytes`) VALUES('10.111.0.137', 'test1@domain.tld', '0000-00-00 00:00:00', '0000-00-00 00:00:00', '{MD5}$1$aK$jD/mJjho87tbzpInzEfOb.', 'test1', '/var/vmail/domain.tld/test1', 'N', 15000000);

CREATE TABLE IF NOT EXISTS `quota` (
  `username` varchar(100) NOT NULL,
  `bytes` bigint(20) NOT NULL DEFAULT '0',
  `messages` int(11) NOT NULL DEFAULT '0',
  `updated` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`username`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `quota` (`username`, `bytes`, `messages`, `updated`) VALUES('test@domain.tld', 39079, 27, '2014-11-30 13:00:06');
INSERT INTO `quota` (`username`, `bytes`, `messages`, `updated`) VALUES('test1@domain.tld', 1474, 1, '2013-09-04 21:34:30');
INSERT INTO `quota` (`username`, `bytes`, `messages`, `updated`) VALUES('admin@domain.tld', 10132801, 4164, '2013-09-04 21:34:42');

CREATE TABLE IF NOT EXISTS `personal_access_list` (
  `sender_address` varchar(64) NOT NULL,
  `recipient_address` varchar(64) NOT NULL,
  `result` varchar(64) NOT NULL,
  `created` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `message` varchar(256) NOT NULL,
  `log_message` varchar(256) NOT NULL,
  PRIMARY KEY (`recipient_address`,`sender_address`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

INSERT INTO `personal_access_list` (`sender_address`, `recipient_address`, `result`, `created`, `message`, `log_message`) VALUES('admin@admin.kiev.ua', 'admin@domain.tld', 'whitelist', '2013-08-30 21:40:37', '', '');
