diff --git a/src/main/resources/db/migration/V6.5.0.2.sql b/src/main/resources/db/migration/V6.5.0.2.sql index a94d81b5dbe..3e7f0a674a6 100644 --- a/src/main/resources/db/migration/V6.5.0.2.sql +++ b/src/main/resources/db/migration/V6.5.0.2.sql @@ -9,10 +9,15 @@ ALTER TABLE datasetversion ADD COLUMN IF NOT EXISTS deaccessionnote VARCHAR(1000 UPDATE datasetversion set deaccessionnote = versionnote; UPDATE datasetversion set versionnote = null; --- Move/merge archivenote contents and remove archivenote column +-- Move/merge archivenote contents and remove archivenote column (on existing DBs that have this column) -- +IF EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'datasetversion'' AND COLUMN_NAME = 'archivenote'') + +BEGIN UPDATE datasetversion set deaccessionlink = CONCAT_WS(' ', deaccessionlink, archivenote); ALTER TABLE datasetversion DROP COLUMN archivenote; +END +