schema/pgsql: add unix_timestamp function

This commit is contained in:
Thomas Gelf 2016-05-21 00:59:16 +02:00
parent 44d9392e70
commit 0605c5acc8
2 changed files with 13 additions and 1 deletions

View File

@ -0,0 +1,7 @@
CREATE OR REPLACE FUNCTION unix_timestamp(timestamp with time zone) RETURNS bigint AS '
SELECT EXTRACT(EPOCH FROM $1)::bigint AS result
' LANGUAGE sql;
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (98, NOW());

View File

@ -49,6 +49,11 @@ CREATE TYPE enum_sync_state AS ENUM(
CREATE TYPE enum_host_service AS ENUM('host', 'service');
CREATE OR REPLACE FUNCTION unix_timestamp(timestamp with time zone) RETURNS bigint AS '
SELECT EXTRACT(EPOCH FROM $1)::bigint AS result
' LANGUAGE sql;
CREATE TABLE director_activity_log (
id bigserial,
object_type character varying(64) NOT NULL,
@ -1524,4 +1529,4 @@ CREATE UNIQUE INDEX notification_inheritance ON icinga_notification_inheritance
INSERT INTO director_schema_migration
(schema_version, migration_time)
VALUES (97, NOW());
VALUES (98, NOW());