From: Tomek Mrugalski Date: Mon, 17 May 2021 16:28:21 +0000 (+0200) Subject: [#90] Minor cleanup X-Git-Tag: eng-drop-2021-11-10~88 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=986d562c8ae4e15ad792f669f07aba6480054872;p=thirdparty%2Fkea.git [#90] Minor cleanup --- diff --git a/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in b/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in index adb71bf0aa..1453b8700b 100644 --- a/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in +++ b/src/share/database/scripts/pgsql/upgrade_6.2_to_7.0.sh.in @@ -45,6 +45,8 @@ CREATE TABLE modification ( ); 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, @@ -54,15 +56,6 @@ CREATE TABLE parameter_data_type ( INSERT INTO parameter_data_type VALUES (0,'integer'),(1,'real'),(2,'boolean'),(4,'string'); -DROP TABLE IF EXISTS `dhcp6_server`; -CREATE TABLE dhcp6_server ( - id SERIAL PRIMARY KEY NOT NULL, - tag varchar(256) UNIQUE NOT NULL, - description text DEFAULT NULL, - modification_ts timestamp NOT NULL DEFAULT Ccurrent_timestamp() ON UPDATE current_timestamp(), - KEY key_dhcp6_server_modification_ts (modification_ts) -); - DROP TABLE IF EXISTS dhcp6_server; CREATE TABLE dhcp6_server ( @@ -72,7 +65,6 @@ CREATE TABLE dhcp6_server ( modification_ts timestamp with time zone NOT NULL DEFAULT CURRENT_TIMESTAMP, UNIQUE(tag) ); - CREATE INDEX dhcp6_server_modification_ts ON dhcp6_server (modification_ts); -- Adding on update trigger in MySQL is as easy as using this column definition in CREATE TABLE: @@ -90,7 +82,12 @@ CREATE OR REPLACE FUNCTION dhcp6_server_modification_ts_update() $dhcp6_server_modification_ts_update$ LANGUAGE plpgsql; -- Finally, we need to create a trigger that will kick off this function. -CREATE TRIGGER dhcp6_server_modification_ts_update AFTER UPDATE ON dhcp6_server FOR EACH ROW EXECUTE PROCEDURE dhcp6_server_modification_ts_update(); +CREATE TRIGGER dhcp6_server_modification_ts_update + AFTER UPDATE ON dhcp6_server + FOR EACH ROW EXECUTE PROCEDURE dhcp6_server_modification_ts_update(); + + + -- Update the schema version number