2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-31 05:55:28 +00:00

[#396,!205] Modify MySQL schema to use fractional second timestamps.

This commit is contained in:
Marcin Siodelski
2019-01-28 13:52:01 +01:00
parent eeb089d4c2
commit c33495fa7a
3 changed files with 171 additions and 3 deletions

View File

@@ -10,12 +10,12 @@ namespace isc {
namespace data {
StampedElement::StampedElement()
: timestamp_(boost::posix_time::second_clock::universal_time()) {
: timestamp_(boost::posix_time::microsecond_clock::universal_time()) {
}
void
StampedElement::updateModificationTime() {
setModificationTime(boost::posix_time::second_clock::universal_time());
setModificationTime(boost::posix_time::microsecond_clock::universal_time());
}
} // end of namespace isc::data

View File

@@ -1334,12 +1334,96 @@ SET version = '7', minor = '0';
# This line concludes database upgrade to version 7.0.
-- -----------------------------------------------------
-- Modify timestamps in the Configuration Backend
-- specific tables to use fractional seconds with
-- 3 decimal places precision.
-- -----------------------------------------------------
ALTER TABLE dhcp4_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_audit
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_global_parameter
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_global_parameter_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_option_def
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_option_def_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_shared_network
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_shared_network_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_subnet
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_pool
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_subnet_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_options
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_options_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_audit
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_global_parameter
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_global_parameter_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_option_def
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_option_def_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_shared_network
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_shared_network_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_subnet
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_pool
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_subnet_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_options
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_options_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
-- -----------------------------------------------------
-- Table `dhcp4_audit_revision`
-- -----------------------------------------------------
CREATE TABLE IF NOT EXISTS dhcp4_audit_revision (
id BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
modification_ts TIMESTAMP NOT NULL,
modification_ts TIMESTAMP(3) NOT NULL,
log_message TEXT,
server_id BIGINT(10) UNSIGNED,
PRIMARY KEY (id),

View File

@@ -17,6 +17,90 @@ fi
mysql "$@" <<EOF
-- -----------------------------------------------------
-- Modify timestamps in the Configuration Backend
-- specific tables to use fractional seconds with
-- 3 decimal places precision.
-- -----------------------------------------------------
ALTER TABLE dhcp4_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_audit
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_global_parameter
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_global_parameter_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_option_def
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_option_def_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_shared_network
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_shared_network_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_subnet
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_pool
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_subnet_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_options
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp4_options_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_audit
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_global_parameter
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_global_parameter_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_option_def
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_option_def_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_shared_network
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_shared_network_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_subnet
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_pool
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_subnet_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_options
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
ALTER TABLE dhcp6_options_server
MODIFY COLUMN modification_ts TIMESTAMP(3) NOT NULL;
# -----------------------------------------------------
# Table dhcp4_audit_revision
# -----------------------------------------------------