[Minor] check if type exist

This commit is contained in:
Reto Breitenmoser 2019-02-16 10:06:03 +01:00
parent 1e1ac785ea
commit 756ca14fa3
1 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,11 @@
CREATE TYPE log_severity_type AS ENUM ('Info', 'Notification', 'Warning', 'Error', 'Exception');
DO $$
BEGIN
IF NOT EXISTS (SELECT 1 FROM pg_type WHERE typname = 'log_severity_type') THEN
CREATE TYPE log_severity_type AS ENUM ('Info', 'Notification', 'Warning', 'Error', 'Exception');
END IF;
END$$;
CREATE TABLE IF NOT EXISTS operations_log (
id varchar(255) PRIMARY KEY,