-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy path08_nt_zone.sql
More file actions
75 lines (69 loc) · 3.37 KB
/
Copy path08_nt_zone.sql
File metadata and controls
75 lines (69 loc) · 3.37 KB
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#
# Copyright 2001 Damon Edwards, Abe Shelton & Greg Schueler
# Copyright 2004-2024 The Network People, Inc.
#
# NicTool is free software; you can redistribute it and/or modify it under
# the terms of the Affero General Public License as published by Affero,
# Inc.; either version 1 of the License, or any later version.
#
# NicTool is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the Affero GPL for details.
#
# You should have received a copy of the Affero General Public License
# along with this program; if not, write to Affero Inc., 521 Third St,
# Suite 225, San Francisco, CA 94107, USA
#
CREATE TABLE IF NOT EXISTS nt_zone(
nt_zone_id INT UNSIGNED AUTO_INCREMENT NOT NULL,
nt_group_id INT UNSIGNED NOT NULL,
zone VARCHAR(255) NOT NULL,
mailaddr VARCHAR(127),
description VARCHAR(255),
serial INT UNSIGNED NOT NULL DEFAULT '1',
refresh INT UNSIGNED,
retry INT UNSIGNED,
expire INT UNSIGNED,
minimum INT UNSIGNED,
ttl INT UNSIGNED,
location VARCHAR(8) DEFAULT NULL,
last_modified TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
last_publish DATETIME DEFAULT NULL,
deleted TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL,
PRIMARY KEY (`nt_zone_id`),
KEY `nt_zone_idx1` (`nt_group_id`),
KEY `nt_zone_idx2` (`deleted`),
KEY `nt_zone_idx3` (`zone`)
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED;
CREATE TABLE IF NOT EXISTS nt_zone_log(
nt_zone_log_id INT UNSIGNED NOT NULL AUTO_INCREMENT,
nt_group_id INT UNSIGNED NOT NULL,
nt_user_id INT UNSIGNED NOT NULL,
action ENUM('added','modified','deleted','moved','recovered') NOT NULL,
timestamp INT UNSIGNED NOT NULL,
nt_zone_id INT UNSIGNED NOT NULL,
zone VARCHAR(255) NOT NULL,
mailaddr VARCHAR(127),
description VARCHAR(255),
serial INT UNSIGNED,
refresh INT UNSIGNED,
retry INT UNSIGNED,
expire INT UNSIGNED,
minimum INT UNSIGNED,
ttl INT UNSIGNED,
location VARCHAR(8) DEFAULT NULL,
PRIMARY KEY (`nt_zone_log_id`),
KEY `nt_zone_log_idx1` (`timestamp`),
KEY `nt_zone_log_idx2` (`nt_zone_id`),
KEY `nt_zone_log_idx3` (`action`),
KEY `nt_group_id` (`nt_group_id`),
KEY `nt_user_id` (`nt_user_id`),
CONSTRAINT `nt_zone_log_ibfk_1` FOREIGN KEY (`nt_zone_id`) REFERENCES `nt_zone` (`nt_zone_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `nt_zone_log_ibfk_2` FOREIGN KEY (`nt_group_id`) REFERENCES `nt_group` (`nt_group_id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `nt_zone_log_ibfk_3` FOREIGN KEY (`nt_user_id`) REFERENCES `nt_user` (`nt_user_id`) ON DELETE CASCADE ON UPDATE CASCADE
) DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED;
CREATE TABLE IF NOT EXISTS nt_zone_nameserver (
nt_zone_id int(10) unsigned NOT NULL,
nt_nameserver_id smallint(5) unsigned NOT NULL,
UNIQUE KEY `zone_ns_id` (`nt_zone_id`,`nt_nameserver_id`)
) DEFAULT CHARSET=utf8mb4;