230 lines
6.4 KiB
SQL
230 lines
6.4 KiB
SQL
-- Host: localhost
|
|
|
|
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
|
|
START TRANSACTION;
|
|
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 utf8mb4 */;
|
|
|
|
--
|
|
-- Database: `vmail`
|
|
--
|
|
CREATE DATABASE IF NOT EXISTS `vmail` DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci;
|
|
USE `vmail`;
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Table structure for table `vm_aliases`
|
|
--
|
|
|
|
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,
|
|
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 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,
|
|
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 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',
|
|
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 IF NOT EXISTS `vm_filters` (
|
|
`id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
|
`mbox_id` int(11) UNSIGNED 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 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,
|
|
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 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,
|
|
`recipient` varchar(255) DEFAULT NULL,
|
|
`message_id` varchar(255) DEFAULT NULL,
|
|
`block_expires` datetime NOT NULL DEFAULT '1000-01-01 00:00:00',
|
|
`record_expires` datetime NOT NULL DEFAULT '9999-12-31 23:59:59',
|
|
`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,
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|
|
--
|
|
-- RELATIONSHIPS FOR TABLE `vm_greylisting`:
|
|
--
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Table structure for table `vm_greylisting_resenders`
|
|
--
|
|
|
|
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(),
|
|
PRIMARY KEY (`id`)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|
|
--
|
|
-- RELATIONSHIPS FOR TABLE `vm_greylisting_resenders`:
|
|
--
|
|
|
|
-- --------------------------------------------------------
|
|
|
|
--
|
|
-- Table structure for table `vm_mboxes`
|
|
--
|
|
|
|
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,
|
|
PRIMARY KEY (`id`),
|
|
KEY `email` (`domain_id`,`mbox`) USING BTREE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
|
|
|
--
|
|
-- RELATIONSHIPS FOR TABLE `vm_mboxes`:
|
|
-- `domain_id`
|
|
-- `vm_domains` -> `id`
|
|
--
|
|
|
|
--
|
|
-- Constraints for dumped tables
|
|
--
|
|
|
|
--
|
|
-- Constraints for table `vm_aliases`
|
|
--
|
|
ALTER TABLE `vm_aliases`
|
|
ADD CONSTRAINT `mbox_delete_aliases` FOREIGN KEY (`mbox_id`) REFERENCES `vm_mboxes` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
|
|
|
--
|
|
-- Constraints for table `vm_autoresponders`
|
|
--
|
|
ALTER TABLE `vm_autoresponders`
|
|
ADD CONSTRAINT `mbox_delete_autoresponders` FOREIGN KEY (`mbox_id`) REFERENCES `vm_mboxes` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
|
|
|
--
|
|
-- Constraints for table `vm_filters`
|
|
--
|
|
ALTER TABLE `vm_filters`
|
|
ADD CONSTRAINT `mbox_delete_filters` FOREIGN KEY (`mbox_id`) REFERENCES `vm_mboxes` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
|
|
|
--
|
|
-- Constraints for table `vm_forwards`
|
|
--
|
|
ALTER TABLE `vm_forwards`
|
|
ADD CONSTRAINT `mbox_delete_forwards` FOREIGN KEY (`mbox_id`) REFERENCES `vm_mboxes` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
|
|
|
--
|
|
-- Constraints for table `vm_mboxes`
|
|
--
|
|
ALTER TABLE `vm_mboxes`
|
|
ADD CONSTRAINT `domain_delete_mboxes` FOREIGN KEY (`domain_id`) REFERENCES `vm_domains` (`id`) ON DELETE CASCADE ON UPDATE NO ACTION;
|
|
COMMIT;
|
|
|
|
/*!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 */;
|