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 (
+ 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,
+ 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:
+-- modification_ts timestamp NOT NULL DEFAULT Ccurrent_timestamp() ON UPDATE current_timestamp(),
+-- Sadly, Postgres has its own convoluted way of doing this:
+
+-- First, we need to define a function that will do the actual job.
+CREATE OR REPLACE FUNCTION dhcp6_server_modification_ts_update()
+ RETURNS trigger AS $dhcp6_server_modification_ts_update$
+ BEGIN
+ new.modification_ts = CURRENT_TIMESTAMP;
+ END;
+
+-- Second, we need to specify which language it was written in.
+$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();
+
+
-- Update the schema version number
UPDATE schema_version
SET version = '7', minor = '0';