diff --git a/src/main/resources/db/migration/V4.14.0.2__2043-split-gbr-table.sql b/src/main/resources/db/migration/V4.14.0.2__2043-split-gbr-table.sql deleted file mode 100644 index b161a093497..00000000000 --- a/src/main/resources/db/migration/V4.14.0.2__2043-split-gbr-table.sql +++ /dev/null @@ -1,4 +0,0 @@ -begin; -insert into filedownload(GUESTBOOKRESPONSE_ID,DOWNLOADTYPE,DOWNLOADTIMESTAMP,SESSIONID) select ID, DOWNLOADTYPE,RESPONSETIME,SESSIONID from guestbookresponse; -alter table guestbookresponse drop column DOWNLOADTYPE, drop column SESSIONID; -commit; diff --git a/src/main/resources/db/migration/V4.15.0.1__2043-split-gbr-table.sql b/src/main/resources/db/migration/V4.15.0.1__2043-split-gbr-table.sql new file mode 100644 index 00000000000..adde91ee1b0 --- /dev/null +++ b/src/main/resources/db/migration/V4.15.0.1__2043-split-gbr-table.sql @@ -0,0 +1,10 @@ +DO $$ +BEGIN +IF EXISTS (SELECT 1 FROM information_schema.columns WHERE table_name='guestbookresponse' AND column_name='downloadtype') THEN + INSERT INTO filedownload(guestbookresponse_id, downloadtype, downloadtimestamp, sessionid) SELECT id, downloadtype, responsetime, sessionid FROM guestbookresponse; + ALTER TABLE guestbookresponse DROP COLUMN downloadtype, DROP COLUMN sessionid; +END IF; +END +$$ + +