-
Notifications
You must be signed in to change notification settings - Fork 4
/
database.sql
48 lines (41 loc) · 1.7 KB
/
database.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
-- phpMyAdmin SQL Dump
-- version 3.4.10.1deb1
-- http://www.phpmyadmin.net
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
CREATE TABLE `aliases` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`source_id` int(11) NOT NULL,
`destination` varchar(64) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `domains` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`ip` varchar(16) NOT NULL,
`mailserver` tinyint(1) NOT NULL,
`modified` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `records` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(64) NOT NULL,
`type` int(11) NOT NULL,
`target` varchar(64) NOT NULL,
`domain_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE TABLE `users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`login` varchar(64) NOT NULL,
`password` varchar(32) NOT NULL,
`domain_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_aliases` AS
select concat(`users`.`login`,'@',`domains`.`name`) AS `email`,`aliases`.`destination` AS `destination`
from ((`aliases` left join `users` on((`aliases`.`source_id` = `users`.`id`))) left join `domains` on((`users`.`domain_id` = `domains`.`id`)));
CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `view_users` AS
select concat(`users`.`login`,'@',`domains`.`name`) AS `email`,`users`.`password` AS `password`
from (`users` left join `domains` on((`users`.`domain_id` = `domains`.`id`)));