From 80e4e419e2ed1d816411403d0c3d1d3a3b952439 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 1 Jun 2015 15:56:01 +0200 Subject: [PATCH] pgsql schema: Add function definition for unix_timestamp This does not seem to require any special privileges since we're using SQL as language and no unusual data types. If this proves false though, feel free to fix this. refs #8826 --- etc/schema/pgsql.schema.sql | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/etc/schema/pgsql.schema.sql b/etc/schema/pgsql.schema.sql index 7f28c5d81..56117d4f8 100644 --- a/etc/schema/pgsql.schema.sql +++ b/etc/schema/pgsql.schema.sql @@ -1,5 +1,9 @@ /* Icinga Web 2 | (c) 2013-2015 Icinga Development Team | GPLv2+ */ +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 "icingaweb_group" ( "id" serial, "name" character varying(64) NOT NULL,