mirror of
https://gitlab.isc.org/isc-projects/kea
synced 2025-08-30 05:27:55 +00:00
[#90] Updated capitalization, removed extra byte for \0
This commit is contained in:
parent
98d46dc464
commit
a6a1425434
@ -153,7 +153,7 @@ CREATE FUNCTION lease4DumpData() RETURNS
|
||||
hwaddr text,
|
||||
client_id text,
|
||||
valid_lifetime bigint,
|
||||
expire timestamp with time zone,
|
||||
expire TIMESTAMP WITH TIME ZONE,
|
||||
subnet_id bigint,
|
||||
fqdn_fwd int,
|
||||
fqdn_rev int,
|
||||
@ -191,7 +191,7 @@ CREATE FUNCTION lease6DumpData() RETURNS
|
||||
address text,
|
||||
duid text,
|
||||
valid_lifetime bigint,
|
||||
expire timestamp with time zone,
|
||||
expire TIMESTAMP WITH TIME ZONE,
|
||||
subnet_id bigint,
|
||||
pref_lifetime bigint,
|
||||
name text,
|
||||
@ -249,7 +249,7 @@ INSERT INTO host_identifier_type VALUES (3, 'client-id');
|
||||
|
||||
CREATE TABLE dhcp_option_scope (
|
||||
scope_id SMALLINT PRIMARY KEY NOT NULL,
|
||||
scope_name varchar(32) DEFAULT NULL
|
||||
scope_name VARCHAR(32) DEFAULT NULL
|
||||
);
|
||||
|
||||
INSERT INTO dhcp_option_scope VALUES (0, 'global');
|
||||
@ -387,7 +387,7 @@ CREATE FUNCTION lease4DumpData() RETURNS
|
||||
hwaddr text,
|
||||
client_id text,
|
||||
valid_lifetime bigint,
|
||||
expire timestamp with time zone,
|
||||
expire TIMESTAMP WITH TIME ZONE,
|
||||
subnet_id bigint,
|
||||
fqdn_fwd int,
|
||||
fqdn_rev int,
|
||||
@ -432,7 +432,7 @@ CREATE FUNCTION lease6DumpData() RETURNS
|
||||
address text,
|
||||
duid text,
|
||||
valid_lifetime bigint,
|
||||
expire timestamp with time zone,
|
||||
expire TIMESTAMP WITH TIME ZONE,
|
||||
subnet_id bigint,
|
||||
pref_lifetime bigint,
|
||||
name text,
|
||||
@ -774,7 +774,7 @@ CREATE FUNCTION lease4DumpData() RETURNS
|
||||
hwaddr text,
|
||||
client_id text,
|
||||
valid_lifetime bigint,
|
||||
expire timestamp with time zone,
|
||||
expire TIMESTAMP WITH TIME ZONE,
|
||||
subnet_id bigint,
|
||||
fqdn_fwd int,
|
||||
fqdn_rev int,
|
||||
@ -813,7 +813,7 @@ CREATE FUNCTION lease6DumpData() RETURNS
|
||||
address text,
|
||||
duid text,
|
||||
valid_lifetime bigint,
|
||||
expire timestamp with time zone,
|
||||
expire TIMESTAMP WITH TIME ZONE,
|
||||
subnet_id bigint,
|
||||
pref_lifetime bigint,
|
||||
name text,
|
||||
@ -1048,7 +1048,7 @@ START TRANSACTION;
|
||||
|
||||
|
||||
-- Adding on update trigger in MySQL is as easy as using this column definition in CREATE TABLE:
|
||||
-- modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
-- modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
-- Sadly, Postgres has its own convoluted way of doing this. Luckily, the update pattern is
|
||||
-- the same in many tables, so we can define the trigger function once and the use it everywhere.
|
||||
|
||||
@ -1067,7 +1067,7 @@ $modification_ts_update$ LANGUAGE plpgsql;
|
||||
-- Create table modification and insert values for modification types.
|
||||
CREATE TABLE modification (
|
||||
id smallint NOT NULL,
|
||||
modification_type varchar(32) NOT NULL,
|
||||
modification_type VARCHAR(32) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
INSERT INTO modification VALUES (0,'create'), (1,'update'), (2,'delete');
|
||||
@ -1077,7 +1077,7 @@ INSERT INTO modification VALUES (0,'create'), (1,'update'), (2,'delete');
|
||||
-- Now create the table that holds different parameter data types.
|
||||
CREATE TABLE parameter_data_type (
|
||||
id smallint NOT NULL,
|
||||
name varchar(32) NOT NULL,
|
||||
name VARCHAR(32) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
INSERT INTO parameter_data_type VALUES
|
||||
@ -1106,13 +1106,13 @@ INSERT INTO ddns_replace_client_name_types (type, name) VALUES
|
||||
-- Create table for DHCPv6 servers
|
||||
CREATE TABLE dhcp6_server (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
tag varchar(256) NOT NULL,
|
||||
description text DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
tag VARCHAR(256) NOT NULL,
|
||||
description TEXT DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(tag)
|
||||
);
|
||||
CREATE INDEX dhcp6_server_idx1 ON dhcp6_server (modification_ts);
|
||||
CREATE UNIQUE INDEX dhcp6_server_idx2 on dhcp6_server(tag);
|
||||
CREATE UNIQUE INDEX dhcp6_server_idx2 ON dhcp6_server(tag);
|
||||
CREATE TRIGGER dhcp6_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -1124,10 +1124,10 @@ INSERT INTO dhcp6_server VALUES (1,'all','special type: all servers');
|
||||
-- Create a table for storing IPv6 shared networks
|
||||
CREATE TABLE dhcp6_shared_network (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
name varchar(128) UNIQUE NOT NULL,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
interface varchar(128) DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
name VARCHAR(128) UNIQUE NOT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
interface VARCHAR(128) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
preferred_lifetime BIGINT DEFAULT NULL,
|
||||
rapid_commit BOOLEAN DEFAULT NULL,
|
||||
rebind_timer BIGINT DEFAULT NULL,
|
||||
@ -1148,8 +1148,8 @@ CREATE TABLE dhcp6_shared_network (
|
||||
ddns_override_no_update BOOLEAN DEFAULT NULL,
|
||||
ddns_override_client_update BOOLEAN DEFAULT NULL,
|
||||
ddns_replace_client_name INT8 DEFAULT NULL,
|
||||
ddns_generated_prefix varchar(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix varchar(255) DEFAULT NULL,
|
||||
ddns_generated_prefix VARCHAR(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix VARCHAR(255) DEFAULT NULL,
|
||||
reservations_global BOOLEAN DEFAULT NULL,
|
||||
reservations_in_subnet BOOLEAN DEFAULT NULL,
|
||||
reservations_out_of_pool BOOLEAN DEFAULT NULL,
|
||||
@ -1170,7 +1170,7 @@ CREATE TRIGGER dhcp6_shared_network_modification_ts_update
|
||||
CREATE TABLE dhcp6_shared_network_server (
|
||||
shared_network_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (shared_network_id, server_id),
|
||||
CONSTRAINT fk_dhcp6_shared_network_server_server_id FOREIGN KEY (server_id)
|
||||
REFERENCES dhcp6_server (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
@ -1185,17 +1185,17 @@ CREATE INDEX dhcp6_shared_network_server_idx2 ON dhcp6_shared_network_server (se
|
||||
-- Create a list of IPv6 subnets
|
||||
CREATE TABLE dhcp6_subnet (
|
||||
subnet_id SERIAL PRIMARY KEY NOT NULL,
|
||||
subnet_prefix varchar(64) UNIQUE NOT NULL,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
interface varchar(128) DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
subnet_prefix VARCHAR(64) UNIQUE NOT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
interface VARCHAR(128) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
preferred_lifetime BIGINT DEFAULT NULL,
|
||||
rapid_commit BOOLEAN DEFAULT NULL,
|
||||
rebind_timer BIGINT DEFAULT NULL,
|
||||
relay TEXT DEFAULT NULL,
|
||||
renew_timer BIGINT DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
shared_network_name varchar(128) DEFAULT NULL,
|
||||
shared_network_name VARCHAR(128) DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
valid_lifetime BIGINT DEFAULT NULL,
|
||||
calculate_tee_times BOOLEAN DEFAULT NULL,
|
||||
@ -1210,8 +1210,8 @@ CREATE TABLE dhcp6_subnet (
|
||||
ddns_override_no_update BOOLEAN DEFAULT NULL,
|
||||
ddns_override_client_update BOOLEAN DEFAULT NULL,
|
||||
ddns_replace_client_name INT8 DEFAULT NULL,
|
||||
ddns_generated_prefix varchar(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix varchar(255) DEFAULT NULL,
|
||||
ddns_generated_prefix VARCHAR(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix VARCHAR(255) DEFAULT NULL,
|
||||
reservations_global BOOLEAN DEFAULT NULL,
|
||||
reservations_in_subnet BOOLEAN DEFAULT NULL,
|
||||
reservations_out_of_pool BOOLEAN DEFAULT NULL,
|
||||
@ -1238,8 +1238,8 @@ CREATE TABLE dhcp6_pool (
|
||||
start_address inet NOT NULL,
|
||||
end_address inet NOT NULL,
|
||||
subnet_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
CONSTRAINT fk_dhcp6_pool_subnet_id FOREIGN KEY (subnet_id) REFERENCES dhcp6_subnet (subnet_id)
|
||||
@ -1255,21 +1255,21 @@ CREATE TRIGGER dhcp6_pool_modification_ts_update
|
||||
-- And now the same, but for PD pools.
|
||||
CREATE TABLE dhcp6_pd_pool (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
prefix varchar(45) NOT NULL,
|
||||
prefix VARCHAR(45) NOT NULL,
|
||||
prefix_length SMALLINT NOT NULL,
|
||||
delegated_prefix_length SMALLINT NOT NULL,
|
||||
subnet_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
excluded_prefix varchar(45) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
excluded_prefix VARCHAR(45) DEFAULT NULL,
|
||||
excluded_prefix_length SMALLINT NOT NULL,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
CONSTRAINT fk_dhcp6_pd_pool_subnet_id FOREIGN KEY (subnet_id) REFERENCES dhcp6_subnet(subnet_id)
|
||||
);
|
||||
|
||||
CREATE INDEX dhcp6_pd_pool_idx1 on dhcp6_pd_pool (modification_ts);
|
||||
CREATE INDEX dhcp6_pd_pool_idx2 on dhcp6_pd_pool (subnet_id);
|
||||
CREATE INDEX dhcp6_pd_pool_idx1 ON dhcp6_pd_pool (modification_ts);
|
||||
CREATE INDEX dhcp6_pd_pool_idx2 ON dhcp6_pd_pool (subnet_id);
|
||||
CREATE TRIGGER dhcp6_pd_pool_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_pd_pool
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -1279,14 +1279,14 @@ CREATE TRIGGER dhcp6_pd_pool_modification_ts_update
|
||||
CREATE TABLE dhcp6_subnet_server (
|
||||
subnet_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (subnet_id, server_id),
|
||||
CONSTRAINT fk_dhcp6_subnet_server_server_id FOREIGN KEY (server_id) REFERENCES dhcp6_server (id),
|
||||
CONSTRAINT fk_dhcp6_subnet_server_subnet_id FOREIGN KEY (subnet_id) REFERENCES dhcp6_subnet (subnet_id),
|
||||
UNIQUE (subnet_id, server_id)
|
||||
);
|
||||
CREATE INDEX dhcp6_subnet_server_idx1 on dhcp6_subnet_server(server_id);
|
||||
CREATE INDEX dhcp6_subnet_server_idx2 on dhcp6_subnet_server(modification_ts);
|
||||
CREATE INDEX dhcp6_subnet_server_idx1 ON dhcp6_subnet_server(server_id);
|
||||
CREATE INDEX dhcp6_subnet_server_idx2 ON dhcp6_subnet_server(modification_ts);
|
||||
CREATE TRIGGER dhcp6_subnet_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_subnet_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -1296,15 +1296,15 @@ CREATE TRIGGER dhcp6_subnet_server_modification_ts_update
|
||||
-- Create table for storing global DHCPv6 parameters.
|
||||
CREATE TABLE dhcp6_global_parameter (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
name varchar(128) NOT NULL,
|
||||
name VARCHAR(128) NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
parameter_type SMALLINT NOT NULL,
|
||||
CONSTRAINT fk_dhcp6_global_parameter_type FOREIGN KEY (parameter_type) REFERENCES parameter_data_type(id)
|
||||
);
|
||||
|
||||
CREATE INDEX key_dhcp6_global_parameter_idx1 on dhcp6_global_parameter(modification_ts);
|
||||
CREATE INDEX key_dhcp6_global_parameter_idx2 on dhcp6_global_parameter(name);
|
||||
CREATE INDEX key_dhcp6_global_parameter_idx1 ON dhcp6_global_parameter(modification_ts);
|
||||
CREATE INDEX key_dhcp6_global_parameter_idx2 ON dhcp6_global_parameter(name);
|
||||
|
||||
CREATE TRIGGER dhcp6_global_parameter_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_global_parameter
|
||||
@ -1314,14 +1314,14 @@ CREATE TRIGGER dhcp6_global_parameter_modification_ts_update
|
||||
CREATE TABLE dhcp6_global_parameter_server (
|
||||
parameter_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (parameter_id, server_id),
|
||||
CONSTRAINT fk_dhcp6_global_parameter_server_parameter_id FOREIGN KEY (parameter_id)
|
||||
REFERENCES dhcp6_global_parameter(id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_dhcp6_global_parameter_server_server_id FOREIGN KEY (server_id)
|
||||
REFERENCES dhcp6_server(id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX key_dhcp6_global_parameter_server_idx1 on dhcp6_global_parameter_server(modification_ts);
|
||||
CREATE INDEX key_dhcp6_global_parameter_server_idx1 ON dhcp6_global_parameter_server(modification_ts);
|
||||
CREATE TRIGGER dhcp6_global_parameter_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_global_parameter_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -1347,15 +1347,15 @@ CREATE TRIGGER dhcp6_options_modification_ts_update
|
||||
CREATE TABLE dhcp6_options_server (
|
||||
option_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (option_id, server_id),
|
||||
CONSTRAINT fk_dhcp6_options_server_option_id FOREIGN KEY (option_id)
|
||||
REFERENCES dhcp6_options (option_id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_dhcp6_options_server_server_id FOREIGN KEY (server_id)
|
||||
REFERENCES dhcp6_server (id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX dhcp6_options_server_idx1 on dhcp6_options_server(server_id);
|
||||
CREATE INDEX dhcp6_options_server_idx2 on dhcp6_options_server(modification_ts);
|
||||
CREATE INDEX dhcp6_options_server_idx1 ON dhcp6_options_server(server_id);
|
||||
CREATE INDEX dhcp6_options_server_idx2 ON dhcp6_options_server(modification_ts);
|
||||
CREATE TRIGGER dhcp6_options_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_options_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -1369,14 +1369,14 @@ CREATE TABLE dhcp6_option_def (
|
||||
name VARCHAR(128) NOT NULL,
|
||||
space VARCHAR(128) NOT NULL,
|
||||
type SMALLINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
is_array BOOLEAN NOT NULL,
|
||||
encapsulate VARCHAR(128) NOT NULL,
|
||||
record_types VARCHAR DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL
|
||||
);
|
||||
CREATE INDEX dhcp6_option_def_idx1 on dhcp6_option_def(modification_ts);
|
||||
CREATE INDEX dhcp6_option_def_idx2 on dhcp6_option_def(code, space);
|
||||
CREATE INDEX dhcp6_option_def_idx1 ON dhcp6_option_def(modification_ts);
|
||||
CREATE INDEX dhcp6_option_def_idx2 ON dhcp6_option_def(code, space);
|
||||
CREATE TRIGGER dhcp6_option_def_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_option_def
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -1386,7 +1386,7 @@ CREATE TRIGGER dhcp6_option_def_modification_ts_update
|
||||
CREATE TABLE dhcp6_option_def_server (
|
||||
option_def_id BIGINT NOT NULL REFERENCES dhcp6_option_def (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
server_id BIGINT NOT NULL REFERENCES dhcp6_server (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (option_def_id, server_id)
|
||||
);
|
||||
CREATE TRIGGER dhcp6_option_def_server_modification_ts_update
|
||||
@ -1397,8 +1397,8 @@ CREATE TRIGGER dhcp6_option_def_server_modification_ts_update
|
||||
-- Now create two tables for audit revisions...
|
||||
CREATE TABLE dhcp6_audit_revision (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
log_message text DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
log_message TEXT DEFAULT NULL,
|
||||
server_id BIGINT DEFAULT NULL
|
||||
);
|
||||
CREATE TRIGGER dhcp6_audit_revision_modification_ts_update
|
||||
@ -1409,7 +1409,7 @@ CREATE TRIGGER dhcp6_audit_revision_modification_ts_update
|
||||
-- ... and the DHCPv6 audit itself.
|
||||
CREATE TABLE dhcp6_audit (
|
||||
id SERIAL UNIQUE NOT NULL,
|
||||
object_type varchar(256) NOT NULL,
|
||||
object_type VARCHAR(256) NOT NULL,
|
||||
object_id BIGINT NOT NULL,
|
||||
modification_type SMALLINT NOT NULL,
|
||||
revision_id BIGINT NOT NULL,
|
||||
@ -1421,16 +1421,16 @@ CREATE TABLE dhcp6_audit (
|
||||
CREATE TRIGGER dhcp6_audit_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_audit
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
CREATE INDEX dhcp6_audit_idx1 on dhcp6_audit (modification_type);
|
||||
CREATE INDEX dhcp6_audit_idx2 on dhcp6_audit (revision_id);
|
||||
CREATE INDEX dhcp6_audit_idx1 ON dhcp6_audit (modification_type);
|
||||
CREATE INDEX dhcp6_audit_idx2 ON dhcp6_audit (revision_id);
|
||||
|
||||
|
||||
-- Create table for DHCPv4 servers
|
||||
CREATE TABLE dhcp4_server (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
tag varchar(256) NOT NULL,
|
||||
description text DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
tag VARCHAR(256) NOT NULL,
|
||||
description TEXT DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(tag)
|
||||
);
|
||||
CREATE INDEX dhcp4_server_modification_ts ON dhcp6_server (modification_ts);
|
||||
@ -1443,14 +1443,14 @@ INSERT INTO dhcp4_server VALUES (1,'all','special type: all servers');
|
||||
-- Create table for storing global DHCPv4 parameters.
|
||||
CREATE TABLE dhcp4_global_parameter (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
name varchar(128) NOT NULL,
|
||||
name VARCHAR(128) NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
parameter_type SMALLINT NOT NULL,
|
||||
CONSTRAINT fk_dhcp6_global_parameter_type FOREIGN KEY (parameter_type) REFERENCES parameter_data_type(id)
|
||||
);
|
||||
CREATE INDEX dhcp4_global_parameter_idx1 on dhcp4_global_parameter(modification_ts);
|
||||
CREATE INDEX dhcp4_global_parameter_idx2 on dhcp4_global_parameter(name);
|
||||
CREATE INDEX dhcp4_global_parameter_idx1 ON dhcp4_global_parameter(modification_ts);
|
||||
CREATE INDEX dhcp4_global_parameter_idx2 ON dhcp4_global_parameter(name);
|
||||
|
||||
CREATE TRIGGER dhcp4_global_parameter_modification_ts_update
|
||||
AFTER UPDATE ON dhcp4_global_parameter
|
||||
@ -1460,7 +1460,7 @@ CREATE TRIGGER dhcp4_global_parameter_modification_ts_update
|
||||
CREATE TABLE dhcp4_global_parameter_server (
|
||||
parameter_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (parameter_id, server_id),
|
||||
CONSTRAINT fk_dhcp4_global_parameter_server_parameter_id FOREIGN KEY (parameter_id)
|
||||
REFERENCES dhcp4_global_parameter(id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
@ -1476,11 +1476,11 @@ CREATE TRIGGER dhcp4_global_parameter_server_modification_ts_update
|
||||
-- Create a table for storing IPv4 shared networks
|
||||
CREATE TABLE dhcp4_shared_network (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
name varchar(128) UNIQUE NOT NULL,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
interface varchar(128) DEFAULT NULL,
|
||||
name VARCHAR(128) UNIQUE NOT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
interface VARCHAR(128) DEFAULT NULL,
|
||||
match_client_id BOOLEAN DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
rebind_timer BIGINT DEFAULT NULL,
|
||||
relay TEXT DEFAULT NULL,
|
||||
renew_timer BIGINT DEFAULT NULL,
|
||||
@ -1491,17 +1491,17 @@ CREATE TABLE dhcp4_shared_network (
|
||||
calculate_tee_times BOOLEAN DEFAULT NULL,
|
||||
t1_percent float DEFAULT NULL,
|
||||
t2_percent float DEFAULT NULL,
|
||||
boot_file_name VARCHAR(129) DEFAULT NULL, -- bootfile field is 128 bytes (plus \0 char)
|
||||
boot_file_name VARCHAR(128) DEFAULT NULL,
|
||||
next_server inet DEFAULT NULL, -- let's use type inet
|
||||
server_hostname varchar(65) DEFAULT NULL, -- sname is 64 bytes long (plus \0 char)
|
||||
server_hostname VARCHAR(64) DEFAULT NULL,
|
||||
min_valid_lifetime BIGINT DEFAULT NULL,
|
||||
max_valid_lifetime BIGINT DEFAULT NULL,
|
||||
ddns_send_updates BOOLEAN DEFAULT NULL,
|
||||
ddns_override_no_update BOOLEAN DEFAULT NULL,
|
||||
ddns_override_client_update BOOLEAN DEFAULT NULL,
|
||||
ddns_replace_client_name INT8 DEFAULT NULL,
|
||||
ddns_generated_prefix varchar(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix varchar(255) DEFAULT NULL,
|
||||
ddns_generated_prefix VARCHAR(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix VARCHAR(255) DEFAULT NULL,
|
||||
reservations_global BOOLEAN DEFAULT NULL,
|
||||
reservations_in_subnet BOOLEAN DEFAULT NULL,
|
||||
reservations_out_of_pool BOOLEAN DEFAULT NULL,
|
||||
@ -1526,18 +1526,18 @@ CREATE TABLE dhcp4_subnet (
|
||||
interface_4o6 VARCHAR(128) DEFAULT NULL,
|
||||
interface_id_4o6 VARCHAR(128) DEFAULT NULL,
|
||||
subnet_4o6 VARCHAR(64) DEFAULT NULL,
|
||||
boot_file_name varchar(129) DEFAULT NULL, -- note the field is 128 bytes long (plus extra \0 char to keep it in memory)
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
interface varchar(128) DEFAULT NULL,
|
||||
boot_file_name VARCHAR(128) DEFAULT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
interface VARCHAR(128) DEFAULT NULL,
|
||||
match_client_id BOOLEAN DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
next_server inet DEFAULT NULL,
|
||||
rebind_timer BIGINT DEFAULT NULL,
|
||||
relay TEXT DEFAULT NULL,
|
||||
renew_timer BIGINT DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
server_hostname varchar(65) DEFAULT NULL, -- sname is 64 bytes long (plus \0 char)
|
||||
shared_network_name varchar(128) DEFAULT NULL,
|
||||
server_hostname VARCHAR(64) DEFAULT NULL,
|
||||
shared_network_name VARCHAR(128) DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
valid_lifetime BIGINT DEFAULT NULL,
|
||||
authoritative BOOLEAN DEFAULT NULL,
|
||||
@ -1550,8 +1550,8 @@ CREATE TABLE dhcp4_subnet (
|
||||
ddns_override_no_update BOOLEAN DEFAULT NULL,
|
||||
ddns_override_client_update BOOLEAN DEFAULT NULL,
|
||||
ddns_replace_client_name INT8 DEFAULT NULL,
|
||||
ddns_generated_prefix varchar(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix varchar(255) DEFAULT NULL,
|
||||
ddns_generated_prefix VARCHAR(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix VARCHAR(255) DEFAULT NULL,
|
||||
reservations_global BOOLEAN DEFAULT NULL,
|
||||
reservations_in_subnet BOOLEAN DEFAULT NULL,
|
||||
reservations_out_of_pool BOOLEAN DEFAULT NULL,
|
||||
@ -1577,8 +1577,8 @@ CREATE TABLE dhcp4_pool (
|
||||
start_address inet NOT NULL,
|
||||
end_address inet NOT NULL,
|
||||
subnet_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
CONSTRAINT fk_dhcp4_pool_subnet_id FOREIGN KEY (subnet_id) REFERENCES dhcp4_subnet (subnet_id)
|
||||
@ -1595,7 +1595,7 @@ CREATE TRIGGER dhcp4_pool_modification_ts_update
|
||||
ALTER TABLE dhcp4_options
|
||||
ADD COLUMN shared_network_name VARCHAR(128) DEFAULT NULL,
|
||||
ADD COLUMN pool_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD CONSTRAINT fk_dhcp4_options_pool FOREIGN KEY (pool_id)
|
||||
REFERENCES dhcp4_pool (id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT fk_dhcp4_options_shared_network FOREIGN KEY (shared_network_name)
|
||||
@ -1611,15 +1611,15 @@ CREATE TRIGGER dhcp4_options_modification_ts_update
|
||||
CREATE TABLE dhcp4_options_server (
|
||||
option_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (option_id, server_id),
|
||||
CONSTRAINT fk_dhcp4_options_server_option_id FOREIGN KEY (option_id)
|
||||
REFERENCES dhcp4_options (option_id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_dhcp4_options_server_server_id FOREIGN KEY (server_id)
|
||||
REFERENCES dhcp4_server (id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX dhcp4_options_server_idx1 on dhcp4_options_server(server_id);
|
||||
CREATE INDEX dhcp4_options_server_idx2 on dhcp4_options_server(modification_ts);
|
||||
CREATE INDEX dhcp4_options_server_idx1 ON dhcp4_options_server(server_id);
|
||||
CREATE INDEX dhcp4_options_server_idx2 ON dhcp4_options_server(modification_ts);
|
||||
CREATE TRIGGER dhcp4_options_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp4_options_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -1633,14 +1633,14 @@ CREATE TABLE dhcp4_option_def (
|
||||
name VARCHAR(128) NOT NULL,
|
||||
space VARCHAR(128) NOT NULL,
|
||||
type SMALLINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
is_array BOOLEAN NOT NULL,
|
||||
encapsulate VARCHAR(128) NOT NULL,
|
||||
record_types VARCHAR DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL
|
||||
);
|
||||
CREATE INDEX dhcp4_option_def_idx1 on dhcp4_option_def(modification_ts);
|
||||
CREATE INDEX dhcp4_option_def_idx2 on dhcp4_option_def(code, space);
|
||||
CREATE INDEX dhcp4_option_def_idx1 ON dhcp4_option_def(modification_ts);
|
||||
CREATE INDEX dhcp4_option_def_idx2 ON dhcp4_option_def(code, space);
|
||||
CREATE TRIGGER dhcp4_option_def_modification_ts_update
|
||||
AFTER UPDATE ON dhcp4_option_def
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -1650,7 +1650,7 @@ CREATE TRIGGER dhcp4_option_def_modification_ts_update
|
||||
CREATE TABLE dhcp4_option_def_server (
|
||||
option_def_id BIGINT NOT NULL REFERENCES dhcp6_option_def (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
server_id BIGINT NOT NULL REFERENCES dhcp4_server (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (option_def_id, server_id)
|
||||
);
|
||||
CREATE TRIGGER dhcp4_option_def_server_modification_ts_update
|
||||
@ -1662,8 +1662,8 @@ CREATE TRIGGER dhcp4_option_def_server_modification_ts_update
|
||||
-- Now create two tables for audit revisions...
|
||||
CREATE TABLE dhcp4_audit_revision (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
log_message text DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
log_message TEXT DEFAULT NULL,
|
||||
server_id BIGINT DEFAULT NULL
|
||||
);
|
||||
CREATE TRIGGER dhcp4_audit_revision_modification_ts_update
|
||||
@ -1674,7 +1674,7 @@ CREATE TRIGGER dhcp4_audit_revision_modification_ts_update
|
||||
-- ... and the DHCPv4 audit itself.
|
||||
CREATE TABLE dhcp4_audit (
|
||||
id SERIAL UNIQUE NOT NULL,
|
||||
object_type varchar(256) NOT NULL,
|
||||
object_type VARCHAR(256) NOT NULL,
|
||||
object_id BIGINT NOT NULL,
|
||||
modification_type SMALLINT NOT NULL,
|
||||
revision_id BIGINT NOT NULL,
|
||||
@ -1686,8 +1686,8 @@ CREATE TABLE dhcp4_audit (
|
||||
CREATE TRIGGER dhcp4_audit_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_audit
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
CREATE INDEX dhcp4_audit_idx1 on dhcp4_audit (modification_type);
|
||||
CREATE INDEX dhcp4_audit_idx2 on dhcp4_audit (revision_id);
|
||||
CREATE INDEX dhcp4_audit_idx1 ON dhcp4_audit (modification_type);
|
||||
CREATE INDEX dhcp4_audit_idx2 ON dhcp4_audit (revision_id);
|
||||
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ START TRANSACTION;
|
||||
|
||||
|
||||
-- Adding on update trigger in MySQL is as easy as using this column definition in CREATE TABLE:
|
||||
-- modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
-- modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||
-- Sadly, Postgres has its own convoluted way of doing this. Luckily, the update pattern is
|
||||
-- the same in many tables, so we can define the trigger function once and the use it everywhere.
|
||||
|
||||
@ -60,7 +60,7 @@ CREATE OR REPLACE FUNCTION modification_ts_update()
|
||||
-- Create table modification and insert values for modification types.
|
||||
CREATE TABLE modification (
|
||||
id smallint NOT NULL,
|
||||
modification_type varchar(32) NOT NULL,
|
||||
modification_type VARCHAR(32) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
INSERT INTO modification VALUES (0,'create'), (1,'update'), (2,'delete');
|
||||
@ -70,7 +70,7 @@ INSERT INTO modification VALUES (0,'create'), (1,'update'), (2,'delete');
|
||||
-- Now create the table that holds different parameter data types.
|
||||
CREATE TABLE parameter_data_type (
|
||||
id smallint NOT NULL,
|
||||
name varchar(32) NOT NULL,
|
||||
name VARCHAR(32) NOT NULL,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
INSERT INTO parameter_data_type VALUES
|
||||
@ -99,13 +99,13 @@ INSERT INTO ddns_replace_client_name_types (type, name) VALUES
|
||||
-- Create table for DHCPv6 servers
|
||||
CREATE TABLE dhcp6_server (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
tag varchar(256) NOT NULL,
|
||||
description text DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
tag VARCHAR(256) NOT NULL,
|
||||
description TEXT DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(tag)
|
||||
);
|
||||
CREATE INDEX dhcp6_server_idx1 ON dhcp6_server (modification_ts);
|
||||
CREATE UNIQUE INDEX dhcp6_server_idx2 on dhcp6_server(tag);
|
||||
CREATE UNIQUE INDEX dhcp6_server_idx2 ON dhcp6_server(tag);
|
||||
CREATE TRIGGER dhcp6_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -117,10 +117,10 @@ INSERT INTO dhcp6_server VALUES (1,'all','special type: all servers');
|
||||
-- Create a table for storing IPv6 shared networks
|
||||
CREATE TABLE dhcp6_shared_network (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
name varchar(128) UNIQUE NOT NULL,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
interface varchar(128) DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
name VARCHAR(128) UNIQUE NOT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
interface VARCHAR(128) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
preferred_lifetime BIGINT DEFAULT NULL,
|
||||
rapid_commit BOOLEAN DEFAULT NULL,
|
||||
rebind_timer BIGINT DEFAULT NULL,
|
||||
@ -141,8 +141,8 @@ CREATE TABLE dhcp6_shared_network (
|
||||
ddns_override_no_update BOOLEAN DEFAULT NULL,
|
||||
ddns_override_client_update BOOLEAN DEFAULT NULL,
|
||||
ddns_replace_client_name INT8 DEFAULT NULL,
|
||||
ddns_generated_prefix varchar(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix varchar(255) DEFAULT NULL,
|
||||
ddns_generated_prefix VARCHAR(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix VARCHAR(255) DEFAULT NULL,
|
||||
reservations_global BOOLEAN DEFAULT NULL,
|
||||
reservations_in_subnet BOOLEAN DEFAULT NULL,
|
||||
reservations_out_of_pool BOOLEAN DEFAULT NULL,
|
||||
@ -163,7 +163,7 @@ CREATE TRIGGER dhcp6_shared_network_modification_ts_update
|
||||
CREATE TABLE dhcp6_shared_network_server (
|
||||
shared_network_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (shared_network_id, server_id),
|
||||
CONSTRAINT fk_dhcp6_shared_network_server_server_id FOREIGN KEY (server_id)
|
||||
REFERENCES dhcp6_server (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
@ -178,17 +178,17 @@ CREATE INDEX dhcp6_shared_network_server_idx2 ON dhcp6_shared_network_server (se
|
||||
-- Create a list of IPv6 subnets
|
||||
CREATE TABLE dhcp6_subnet (
|
||||
subnet_id SERIAL PRIMARY KEY NOT NULL,
|
||||
subnet_prefix varchar(64) UNIQUE NOT NULL,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
interface varchar(128) DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
subnet_prefix VARCHAR(64) UNIQUE NOT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
interface VARCHAR(128) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
preferred_lifetime BIGINT DEFAULT NULL,
|
||||
rapid_commit BOOLEAN DEFAULT NULL,
|
||||
rebind_timer BIGINT DEFAULT NULL,
|
||||
relay TEXT DEFAULT NULL,
|
||||
renew_timer BIGINT DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
shared_network_name varchar(128) DEFAULT NULL,
|
||||
shared_network_name VARCHAR(128) DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
valid_lifetime BIGINT DEFAULT NULL,
|
||||
calculate_tee_times BOOLEAN DEFAULT NULL,
|
||||
@ -203,8 +203,8 @@ CREATE TABLE dhcp6_subnet (
|
||||
ddns_override_no_update BOOLEAN DEFAULT NULL,
|
||||
ddns_override_client_update BOOLEAN DEFAULT NULL,
|
||||
ddns_replace_client_name INT8 DEFAULT NULL,
|
||||
ddns_generated_prefix varchar(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix varchar(255) DEFAULT NULL,
|
||||
ddns_generated_prefix VARCHAR(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix VARCHAR(255) DEFAULT NULL,
|
||||
reservations_global BOOLEAN DEFAULT NULL,
|
||||
reservations_in_subnet BOOLEAN DEFAULT NULL,
|
||||
reservations_out_of_pool BOOLEAN DEFAULT NULL,
|
||||
@ -231,8 +231,8 @@ CREATE TABLE dhcp6_pool (
|
||||
start_address inet NOT NULL,
|
||||
end_address inet NOT NULL,
|
||||
subnet_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
CONSTRAINT fk_dhcp6_pool_subnet_id FOREIGN KEY (subnet_id) REFERENCES dhcp6_subnet (subnet_id)
|
||||
@ -248,21 +248,21 @@ CREATE TRIGGER dhcp6_pool_modification_ts_update
|
||||
-- And now the same, but for PD pools.
|
||||
CREATE TABLE dhcp6_pd_pool (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
prefix varchar(45) NOT NULL,
|
||||
prefix VARCHAR(45) NOT NULL,
|
||||
prefix_length SMALLINT NOT NULL,
|
||||
delegated_prefix_length SMALLINT NOT NULL,
|
||||
subnet_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
excluded_prefix varchar(45) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
excluded_prefix VARCHAR(45) DEFAULT NULL,
|
||||
excluded_prefix_length SMALLINT NOT NULL,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
CONSTRAINT fk_dhcp6_pd_pool_subnet_id FOREIGN KEY (subnet_id) REFERENCES dhcp6_subnet(subnet_id)
|
||||
);
|
||||
|
||||
CREATE INDEX dhcp6_pd_pool_idx1 on dhcp6_pd_pool (modification_ts);
|
||||
CREATE INDEX dhcp6_pd_pool_idx2 on dhcp6_pd_pool (subnet_id);
|
||||
CREATE INDEX dhcp6_pd_pool_idx1 ON dhcp6_pd_pool (modification_ts);
|
||||
CREATE INDEX dhcp6_pd_pool_idx2 ON dhcp6_pd_pool (subnet_id);
|
||||
CREATE TRIGGER dhcp6_pd_pool_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_pd_pool
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -272,14 +272,14 @@ CREATE TRIGGER dhcp6_pd_pool_modification_ts_update
|
||||
CREATE TABLE dhcp6_subnet_server (
|
||||
subnet_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (subnet_id, server_id),
|
||||
CONSTRAINT fk_dhcp6_subnet_server_server_id FOREIGN KEY (server_id) REFERENCES dhcp6_server (id),
|
||||
CONSTRAINT fk_dhcp6_subnet_server_subnet_id FOREIGN KEY (subnet_id) REFERENCES dhcp6_subnet (subnet_id),
|
||||
UNIQUE (subnet_id, server_id)
|
||||
);
|
||||
CREATE INDEX dhcp6_subnet_server_idx1 on dhcp6_subnet_server(server_id);
|
||||
CREATE INDEX dhcp6_subnet_server_idx2 on dhcp6_subnet_server(modification_ts);
|
||||
CREATE INDEX dhcp6_subnet_server_idx1 ON dhcp6_subnet_server(server_id);
|
||||
CREATE INDEX dhcp6_subnet_server_idx2 ON dhcp6_subnet_server(modification_ts);
|
||||
CREATE TRIGGER dhcp6_subnet_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_subnet_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -289,15 +289,15 @@ CREATE TRIGGER dhcp6_subnet_server_modification_ts_update
|
||||
-- Create table for storing global DHCPv6 parameters.
|
||||
CREATE TABLE dhcp6_global_parameter (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
name varchar(128) NOT NULL,
|
||||
name VARCHAR(128) NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
parameter_type SMALLINT NOT NULL,
|
||||
CONSTRAINT fk_dhcp6_global_parameter_type FOREIGN KEY (parameter_type) REFERENCES parameter_data_type(id)
|
||||
);
|
||||
|
||||
CREATE INDEX key_dhcp6_global_parameter_idx1 on dhcp6_global_parameter(modification_ts);
|
||||
CREATE INDEX key_dhcp6_global_parameter_idx2 on dhcp6_global_parameter(name);
|
||||
CREATE INDEX key_dhcp6_global_parameter_idx1 ON dhcp6_global_parameter(modification_ts);
|
||||
CREATE INDEX key_dhcp6_global_parameter_idx2 ON dhcp6_global_parameter(name);
|
||||
|
||||
CREATE TRIGGER dhcp6_global_parameter_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_global_parameter
|
||||
@ -307,14 +307,14 @@ CREATE TRIGGER dhcp6_global_parameter_modification_ts_update
|
||||
CREATE TABLE dhcp6_global_parameter_server (
|
||||
parameter_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (parameter_id, server_id),
|
||||
CONSTRAINT fk_dhcp6_global_parameter_server_parameter_id FOREIGN KEY (parameter_id)
|
||||
REFERENCES dhcp6_global_parameter(id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_dhcp6_global_parameter_server_server_id FOREIGN KEY (server_id)
|
||||
REFERENCES dhcp6_server(id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX key_dhcp6_global_parameter_server_idx1 on dhcp6_global_parameter_server(modification_ts);
|
||||
CREATE INDEX key_dhcp6_global_parameter_server_idx1 ON dhcp6_global_parameter_server(modification_ts);
|
||||
CREATE TRIGGER dhcp6_global_parameter_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_global_parameter_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -340,15 +340,15 @@ CREATE TRIGGER dhcp6_options_modification_ts_update
|
||||
CREATE TABLE dhcp6_options_server (
|
||||
option_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (option_id, server_id),
|
||||
CONSTRAINT fk_dhcp6_options_server_option_id FOREIGN KEY (option_id)
|
||||
REFERENCES dhcp6_options (option_id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_dhcp6_options_server_server_id FOREIGN KEY (server_id)
|
||||
REFERENCES dhcp6_server (id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX dhcp6_options_server_idx1 on dhcp6_options_server(server_id);
|
||||
CREATE INDEX dhcp6_options_server_idx2 on dhcp6_options_server(modification_ts);
|
||||
CREATE INDEX dhcp6_options_server_idx1 ON dhcp6_options_server(server_id);
|
||||
CREATE INDEX dhcp6_options_server_idx2 ON dhcp6_options_server(modification_ts);
|
||||
CREATE TRIGGER dhcp6_options_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_options_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -362,14 +362,14 @@ CREATE TABLE dhcp6_option_def (
|
||||
name VARCHAR(128) NOT NULL,
|
||||
space VARCHAR(128) NOT NULL,
|
||||
type SMALLINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
is_array BOOLEAN NOT NULL,
|
||||
encapsulate VARCHAR(128) NOT NULL,
|
||||
record_types VARCHAR DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL
|
||||
);
|
||||
CREATE INDEX dhcp6_option_def_idx1 on dhcp6_option_def(modification_ts);
|
||||
CREATE INDEX dhcp6_option_def_idx2 on dhcp6_option_def(code, space);
|
||||
CREATE INDEX dhcp6_option_def_idx1 ON dhcp6_option_def(modification_ts);
|
||||
CREATE INDEX dhcp6_option_def_idx2 ON dhcp6_option_def(code, space);
|
||||
CREATE TRIGGER dhcp6_option_def_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_option_def
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -379,7 +379,7 @@ CREATE TRIGGER dhcp6_option_def_modification_ts_update
|
||||
CREATE TABLE dhcp6_option_def_server (
|
||||
option_def_id BIGINT NOT NULL REFERENCES dhcp6_option_def (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
server_id BIGINT NOT NULL REFERENCES dhcp6_server (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (option_def_id, server_id)
|
||||
);
|
||||
CREATE TRIGGER dhcp6_option_def_server_modification_ts_update
|
||||
@ -390,8 +390,8 @@ CREATE TRIGGER dhcp6_option_def_server_modification_ts_update
|
||||
-- Now create two tables for audit revisions...
|
||||
CREATE TABLE dhcp6_audit_revision (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
log_message text DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
log_message TEXT DEFAULT NULL,
|
||||
server_id BIGINT DEFAULT NULL
|
||||
);
|
||||
CREATE TRIGGER dhcp6_audit_revision_modification_ts_update
|
||||
@ -402,7 +402,7 @@ CREATE TRIGGER dhcp6_audit_revision_modification_ts_update
|
||||
-- ... and the DHCPv6 audit itself.
|
||||
CREATE TABLE dhcp6_audit (
|
||||
id SERIAL UNIQUE NOT NULL,
|
||||
object_type varchar(256) NOT NULL,
|
||||
object_type VARCHAR(256) NOT NULL,
|
||||
object_id BIGINT NOT NULL,
|
||||
modification_type SMALLINT NOT NULL,
|
||||
revision_id BIGINT NOT NULL,
|
||||
@ -414,16 +414,16 @@ CREATE TABLE dhcp6_audit (
|
||||
CREATE TRIGGER dhcp6_audit_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_audit
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
CREATE INDEX dhcp6_audit_idx1 on dhcp6_audit (modification_type);
|
||||
CREATE INDEX dhcp6_audit_idx2 on dhcp6_audit (revision_id);
|
||||
CREATE INDEX dhcp6_audit_idx1 ON dhcp6_audit (modification_type);
|
||||
CREATE INDEX dhcp6_audit_idx2 ON dhcp6_audit (revision_id);
|
||||
|
||||
|
||||
-- Create table for DHCPv4 servers
|
||||
CREATE TABLE dhcp4_server (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
tag varchar(256) NOT NULL,
|
||||
description text DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
tag VARCHAR(256) NOT NULL,
|
||||
description TEXT DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
UNIQUE(tag)
|
||||
);
|
||||
CREATE INDEX dhcp4_server_modification_ts ON dhcp6_server (modification_ts);
|
||||
@ -436,14 +436,14 @@ INSERT INTO dhcp4_server VALUES (1,'all','special type: all servers');
|
||||
-- Create table for storing global DHCPv4 parameters.
|
||||
CREATE TABLE dhcp4_global_parameter (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
name varchar(128) NOT NULL,
|
||||
name VARCHAR(128) NOT NULL,
|
||||
value TEXT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
parameter_type SMALLINT NOT NULL,
|
||||
CONSTRAINT fk_dhcp6_global_parameter_type FOREIGN KEY (parameter_type) REFERENCES parameter_data_type(id)
|
||||
);
|
||||
CREATE INDEX dhcp4_global_parameter_idx1 on dhcp4_global_parameter(modification_ts);
|
||||
CREATE INDEX dhcp4_global_parameter_idx2 on dhcp4_global_parameter(name);
|
||||
CREATE INDEX dhcp4_global_parameter_idx1 ON dhcp4_global_parameter(modification_ts);
|
||||
CREATE INDEX dhcp4_global_parameter_idx2 ON dhcp4_global_parameter(name);
|
||||
|
||||
CREATE TRIGGER dhcp4_global_parameter_modification_ts_update
|
||||
AFTER UPDATE ON dhcp4_global_parameter
|
||||
@ -453,7 +453,7 @@ CREATE TRIGGER dhcp4_global_parameter_modification_ts_update
|
||||
CREATE TABLE dhcp4_global_parameter_server (
|
||||
parameter_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (parameter_id, server_id),
|
||||
CONSTRAINT fk_dhcp4_global_parameter_server_parameter_id FOREIGN KEY (parameter_id)
|
||||
REFERENCES dhcp4_global_parameter(id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
@ -469,11 +469,11 @@ CREATE TRIGGER dhcp4_global_parameter_server_modification_ts_update
|
||||
-- Create a table for storing IPv4 shared networks
|
||||
CREATE TABLE dhcp4_shared_network (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
name varchar(128) UNIQUE NOT NULL,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
interface varchar(128) DEFAULT NULL,
|
||||
name VARCHAR(128) UNIQUE NOT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
interface VARCHAR(128) DEFAULT NULL,
|
||||
match_client_id BOOLEAN DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
rebind_timer BIGINT DEFAULT NULL,
|
||||
relay TEXT DEFAULT NULL,
|
||||
renew_timer BIGINT DEFAULT NULL,
|
||||
@ -484,17 +484,17 @@ CREATE TABLE dhcp4_shared_network (
|
||||
calculate_tee_times BOOLEAN DEFAULT NULL,
|
||||
t1_percent float DEFAULT NULL,
|
||||
t2_percent float DEFAULT NULL,
|
||||
boot_file_name VARCHAR(129) DEFAULT NULL, -- bootfile field is 128 bytes (plus \0 char)
|
||||
boot_file_name VARCHAR(128) DEFAULT NULL,
|
||||
next_server inet DEFAULT NULL, -- let's use type inet
|
||||
server_hostname varchar(65) DEFAULT NULL, -- sname is 64 bytes long (plus \0 char)
|
||||
server_hostname VARCHAR(64) DEFAULT NULL,
|
||||
min_valid_lifetime BIGINT DEFAULT NULL,
|
||||
max_valid_lifetime BIGINT DEFAULT NULL,
|
||||
ddns_send_updates BOOLEAN DEFAULT NULL,
|
||||
ddns_override_no_update BOOLEAN DEFAULT NULL,
|
||||
ddns_override_client_update BOOLEAN DEFAULT NULL,
|
||||
ddns_replace_client_name INT8 DEFAULT NULL,
|
||||
ddns_generated_prefix varchar(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix varchar(255) DEFAULT NULL,
|
||||
ddns_generated_prefix VARCHAR(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix VARCHAR(255) DEFAULT NULL,
|
||||
reservations_global BOOLEAN DEFAULT NULL,
|
||||
reservations_in_subnet BOOLEAN DEFAULT NULL,
|
||||
reservations_out_of_pool BOOLEAN DEFAULT NULL,
|
||||
@ -519,18 +519,18 @@ CREATE TABLE dhcp4_subnet (
|
||||
interface_4o6 VARCHAR(128) DEFAULT NULL,
|
||||
interface_id_4o6 VARCHAR(128) DEFAULT NULL,
|
||||
subnet_4o6 VARCHAR(64) DEFAULT NULL,
|
||||
boot_file_name varchar(129) DEFAULT NULL, -- note the field is 128 bytes long (plus extra \0 char to keep it in memory)
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
interface varchar(128) DEFAULT NULL,
|
||||
boot_file_name VARCHAR(128) DEFAULT NULL,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
interface VARCHAR(128) DEFAULT NULL,
|
||||
match_client_id BOOLEAN DEFAULT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
next_server inet DEFAULT NULL,
|
||||
rebind_timer BIGINT DEFAULT NULL,
|
||||
relay TEXT DEFAULT NULL,
|
||||
renew_timer BIGINT DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
server_hostname varchar(65) DEFAULT NULL, -- sname is 64 bytes long (plus \0 char)
|
||||
shared_network_name varchar(128) DEFAULT NULL,
|
||||
server_hostname VARCHAR(64) DEFAULT NULL,
|
||||
shared_network_name VARCHAR(128) DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
valid_lifetime BIGINT DEFAULT NULL,
|
||||
authoritative BOOLEAN DEFAULT NULL,
|
||||
@ -543,8 +543,8 @@ CREATE TABLE dhcp4_subnet (
|
||||
ddns_override_no_update BOOLEAN DEFAULT NULL,
|
||||
ddns_override_client_update BOOLEAN DEFAULT NULL,
|
||||
ddns_replace_client_name INT8 DEFAULT NULL,
|
||||
ddns_generated_prefix varchar(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix varchar(255) DEFAULT NULL,
|
||||
ddns_generated_prefix VARCHAR(255) DEFAULT NULL,
|
||||
ddns_qualifying_suffix VARCHAR(255) DEFAULT NULL,
|
||||
reservations_global BOOLEAN DEFAULT NULL,
|
||||
reservations_in_subnet BOOLEAN DEFAULT NULL,
|
||||
reservations_out_of_pool BOOLEAN DEFAULT NULL,
|
||||
@ -570,8 +570,8 @@ CREATE TABLE dhcp4_pool (
|
||||
start_address inet NOT NULL,
|
||||
end_address inet NOT NULL,
|
||||
subnet_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
client_class varchar(128) DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
client_class VARCHAR(128) DEFAULT NULL,
|
||||
require_client_classes TEXT DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL,
|
||||
CONSTRAINT fk_dhcp4_pool_subnet_id FOREIGN KEY (subnet_id) REFERENCES dhcp4_subnet (subnet_id)
|
||||
@ -588,7 +588,7 @@ CREATE TRIGGER dhcp4_pool_modification_ts_update
|
||||
ALTER TABLE dhcp4_options
|
||||
ADD COLUMN shared_network_name VARCHAR(128) DEFAULT NULL,
|
||||
ADD COLUMN pool_id BIGINT DEFAULT NULL,
|
||||
ADD COLUMN modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD COLUMN modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
ADD CONSTRAINT fk_dhcp4_options_pool FOREIGN KEY (pool_id)
|
||||
REFERENCES dhcp4_pool (id) ON DELETE CASCADE ON UPDATE CASCADE,
|
||||
ADD CONSTRAINT fk_dhcp4_options_shared_network FOREIGN KEY (shared_network_name)
|
||||
@ -604,15 +604,15 @@ CREATE TRIGGER dhcp4_options_modification_ts_update
|
||||
CREATE TABLE dhcp4_options_server (
|
||||
option_id BIGINT NOT NULL,
|
||||
server_id BIGINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (option_id, server_id),
|
||||
CONSTRAINT fk_dhcp4_options_server_option_id FOREIGN KEY (option_id)
|
||||
REFERENCES dhcp4_options (option_id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_dhcp4_options_server_server_id FOREIGN KEY (server_id)
|
||||
REFERENCES dhcp4_server (id) ON DELETE CASCADE ON UPDATE NO ACTION
|
||||
);
|
||||
CREATE INDEX dhcp4_options_server_idx1 on dhcp4_options_server(server_id);
|
||||
CREATE INDEX dhcp4_options_server_idx2 on dhcp4_options_server(modification_ts);
|
||||
CREATE INDEX dhcp4_options_server_idx1 ON dhcp4_options_server(server_id);
|
||||
CREATE INDEX dhcp4_options_server_idx2 ON dhcp4_options_server(modification_ts);
|
||||
CREATE TRIGGER dhcp4_options_server_modification_ts_update
|
||||
AFTER UPDATE ON dhcp4_options_server
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -626,14 +626,14 @@ CREATE TABLE dhcp4_option_def (
|
||||
name VARCHAR(128) NOT NULL,
|
||||
space VARCHAR(128) NOT NULL,
|
||||
type SMALLINT NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
is_array BOOLEAN NOT NULL,
|
||||
encapsulate VARCHAR(128) NOT NULL,
|
||||
record_types VARCHAR DEFAULT NULL,
|
||||
user_context JSON DEFAULT NULL
|
||||
);
|
||||
CREATE INDEX dhcp4_option_def_idx1 on dhcp4_option_def(modification_ts);
|
||||
CREATE INDEX dhcp4_option_def_idx2 on dhcp4_option_def(code, space);
|
||||
CREATE INDEX dhcp4_option_def_idx1 ON dhcp4_option_def(modification_ts);
|
||||
CREATE INDEX dhcp4_option_def_idx2 ON dhcp4_option_def(code, space);
|
||||
CREATE TRIGGER dhcp4_option_def_modification_ts_update
|
||||
AFTER UPDATE ON dhcp4_option_def
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
@ -643,7 +643,7 @@ CREATE TRIGGER dhcp4_option_def_modification_ts_update
|
||||
CREATE TABLE dhcp4_option_def_server (
|
||||
option_def_id BIGINT NOT NULL REFERENCES dhcp6_option_def (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
server_id BIGINT NOT NULL REFERENCES dhcp4_server (id) ON DELETE CASCADE ON UPDATE NO ACTION,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
PRIMARY KEY (option_def_id, server_id)
|
||||
);
|
||||
CREATE TRIGGER dhcp4_option_def_server_modification_ts_update
|
||||
@ -655,8 +655,8 @@ CREATE TRIGGER dhcp4_option_def_server_modification_ts_update
|
||||
-- Now create two tables for audit revisions...
|
||||
CREATE TABLE dhcp4_audit_revision (
|
||||
id SERIAL PRIMARY KEY NOT NULL,
|
||||
modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
log_message text DEFAULT NULL,
|
||||
modification_ts TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
log_message TEXT DEFAULT NULL,
|
||||
server_id BIGINT DEFAULT NULL
|
||||
);
|
||||
CREATE TRIGGER dhcp4_audit_revision_modification_ts_update
|
||||
@ -667,7 +667,7 @@ CREATE TRIGGER dhcp4_audit_revision_modification_ts_update
|
||||
-- ... and the DHCPv4 audit itself.
|
||||
CREATE TABLE dhcp4_audit (
|
||||
id SERIAL UNIQUE NOT NULL,
|
||||
object_type varchar(256) NOT NULL,
|
||||
object_type VARCHAR(256) NOT NULL,
|
||||
object_id BIGINT NOT NULL,
|
||||
modification_type SMALLINT NOT NULL,
|
||||
revision_id BIGINT NOT NULL,
|
||||
@ -679,8 +679,8 @@ CREATE TABLE dhcp4_audit (
|
||||
CREATE TRIGGER dhcp4_audit_modification_ts_update
|
||||
AFTER UPDATE ON dhcp6_audit
|
||||
FOR EACH ROW EXECUTE PROCEDURE modification_ts_update();
|
||||
CREATE INDEX dhcp4_audit_idx1 on dhcp4_audit (modification_type);
|
||||
CREATE INDEX dhcp4_audit_idx2 on dhcp4_audit (revision_id);
|
||||
CREATE INDEX dhcp4_audit_idx1 ON dhcp4_audit (modification_type);
|
||||
CREATE INDEX dhcp4_audit_idx2 ON dhcp4_audit (revision_id);
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user