From 4fa2427ea9a9cb0c6a08517fa8c4f0c42dadbdee Mon Sep 17 00:00:00 2001
From: aboeckle <alexander.boeckle@frentix.com>
Date: Wed, 2 Sep 2020 16:11:45 +0200
Subject: [PATCH] OO-4854: Setup database fix

---
 src/main/resources/database/mysql/setupDatabase.sql      | 6 ++----
 src/main/resources/database/oracle/setupDatabase.sql     | 6 ++----
 src/main/resources/database/postgresql/setupDatabase.sql | 6 ++----
 3 files changed, 6 insertions(+), 12 deletions(-)

diff --git a/src/main/resources/database/mysql/setupDatabase.sql b/src/main/resources/database/mysql/setupDatabase.sql
index 6dbe90fee8a..0143e107bad 100644
--- a/src/main/resources/database/mysql/setupDatabase.sql
+++ b/src/main/resources/database/mysql/setupDatabase.sql
@@ -263,6 +263,8 @@ create table if not exists o_catentry (
    parent_id bigint,
    order_index bigint, 
    short_title varchar(255),
+   add_entry_position int,
+   add_category_position int,
    primary key (id)
 );
 create table if not exists o_note (
@@ -4196,7 +4198,3 @@ alter table o_ap_participation add constraint ap_part_identity_idx foreign key (
 
 insert into hibernate_unique_key values ( 0 );
 SET FOREIGN_KEY_CHECKS = 1;
-
--- Catalog
-alter table o_catentry add column add_entry_position int;
-alter table o_catentry add column add_category_position int;
diff --git a/src/main/resources/database/oracle/setupDatabase.sql b/src/main/resources/database/oracle/setupDatabase.sql
index f77269eb3e4..7ddf6dfa9f4 100644
--- a/src/main/resources/database/oracle/setupDatabase.sql
+++ b/src/main/resources/database/oracle/setupDatabase.sql
@@ -291,6 +291,8 @@ CREATE TABLE o_catentry (
   parent_id number(20),
   order_index number(20),
   short_title varchar2(255 char),
+  add_entry_position number default null,
+  add_category_position number default null,
   CONSTRAINT u_o_catentry UNIQUE (fk_ownergroup),
   PRIMARY KEY (id)
 );
@@ -4402,9 +4404,5 @@ create index idx_ap_part_identitiy_idx on o_ap_participation(fk_identity_id);
 insert into o_stat_lastupdated (until_datetime, from_datetime, lastupdated) values (to_date('1999-01-01', 'YYYY-mm-dd'), to_date('1999-01-01', 'YYYY-mm-dd'), to_date('1999-01-01', 'YYYY-mm-dd'));
 insert into hibernate_unique_key values ( 0 );
 
--- Catalog
-alter table o_catentry add add_entry_position number default null;
-alter table o_catentry add add_category_position number default null;
-
 commit
 /
diff --git a/src/main/resources/database/postgresql/setupDatabase.sql b/src/main/resources/database/postgresql/setupDatabase.sql
index 02f04137943..2ad1e0eb33e 100644
--- a/src/main/resources/database/postgresql/setupDatabase.sql
+++ b/src/main/resources/database/postgresql/setupDatabase.sql
@@ -261,6 +261,8 @@ create table o_catentry (
    parent_id int8,
    order_index int8,
    short_title varchar(255),
+   add_entry_position int,
+   add_category_position int,
    primary key (id)
 );
 create table o_note (
@@ -4293,7 +4295,3 @@ alter table o_ap_participation add constraint ap_part_identity_idx foreign key (
 create index idx_ap_part_identitiy_idx on o_ap_participation(fk_identity_id);
 
 insert into hibernate_unique_key values ( 0 );
-
--- Catalog
-alter table o_catentry add column add_entry_position int;
-alter table o_catentry add column add_category_position int;
-- 
GitLab