From 756ca14fa374848e50cbb5414faeb36ed456d83e Mon Sep 17 00:00:00 2001 From: Reto Breitenmoser Date: Sat, 16 Feb 2019 10:06:03 +0100 Subject: [PATCH] [Minor] check if type exist --- .../main/resources/strolch_db_schema_0.7.0_migration.sql | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/li.strolch.persistence.postgresql/src/main/resources/strolch_db_schema_0.7.0_migration.sql b/li.strolch.persistence.postgresql/src/main/resources/strolch_db_schema_0.7.0_migration.sql index 925edbb67..f14de389c 100644 --- a/li.strolch.persistence.postgresql/src/main/resources/strolch_db_schema_0.7.0_migration.sql +++ b/li.strolch.persistence.postgresql/src/main/resources/strolch_db_schema_0.7.0_migration.sql @@ -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,