From ab194f0bfa4f0a6a21abfe416d1d9385b971f9d7 Mon Sep 17 00:00:00 2001
From: Lyn Elisa Goltz <goltz@lat-lon.de>
Date: Mon, 27 Nov 2023 12:16:28 +0100
Subject: [PATCH] XPLANBOX-2308 - added CREATE TABLE IF NOT EXISTS
 databasechangeloglock

---
 .../src/main/resources/update/from_7.0_to_7.1/migrate.sql   | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/xplan-resources/xplan-sql-scripts/src/main/resources/update/from_7.0_to_7.1/migrate.sql b/xplan-resources/xplan-sql-scripts/src/main/resources/update/from_7.0_to_7.1/migrate.sql
index 0aee68450..fe9aaa8a1 100644
--- a/xplan-resources/xplan-sql-scripts/src/main/resources/update/from_7.0_to_7.1/migrate.sql
+++ b/xplan-resources/xplan-sql-scripts/src/main/resources/update/from_7.0_to_7.1/migrate.sql
@@ -1,5 +1,11 @@
 SET SEARCH_PATH TO public, "$user","public";
 
+-- Create Database Lock Table
+CREATE TABLE IF NOT EXISTS databasechangeloglock (ID INTEGER NOT NULL, LOCKED BOOLEAN NOT NULL, LOCKGRANTED TIMESTAMP WITHOUT TIME ZONE, LOCKEDBY VARCHAR(255), CONSTRAINT databasechangeloglock_pkey PRIMARY KEY (ID));
+
+-- Initialize Database Lock Table
+DELETE FROM databasechangeloglock;
+
 -- Lock Database
 UPDATE databasechangeloglock SET LOCKED = TRUE, LOCKEDBY = 'cpe-172-101-0-1.maine.res.rr.com (172.101.0.1)', LOCKGRANTED = NOW() WHERE ID = 1 AND LOCKED = FALSE;
 
-- 
GitLab