From 7d080b3ba794e6bbefa55165b7e9eb6680ec4721 Mon Sep 17 00:00:00 2001
From: alaskowski <alaskowski@ethz.ch>
Date: Mon, 15 May 2023 13:54:42 +0200
Subject: [PATCH] SSDM-13524: fixed database migration scripts

---
 .../sql/postgresql/migration/migration-190-191.sql       | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/server-application-server/source/sql/postgresql/migration/migration-190-191.sql b/server-application-server/source/sql/postgresql/migration/migration-190-191.sql
index 804f3d8b7db..d2412a47d54 100644
--- a/server-application-server/source/sql/postgresql/migration/migration-190-191.sql
+++ b/server-application-server/source/sql/postgresql/migration/migration-190-191.sql
@@ -183,8 +183,7 @@ ALTER TABLE DATA_SET_PROPERTIES_HISTORY ADD CONSTRAINT DSPRH_CK CHECK
 
 
 
-DROP VIEW sample_history_view;
-CREATE VIEW sample_history_view AS (
+CREATE OR REPLACE VIEW sample_history_view AS (
   SELECT
     2*id as id,
     main_samp_id,
@@ -244,8 +243,7 @@ UNION
     SAMPLE_PROPERTIES_HISTORY;
 
 
-DROP VIEW data_set_history_view;
-CREATE VIEW data_set_history_view AS (
+CREATE OR REPLACE VIEW data_set_history_view AS (
   SELECT
     3*id as id,
     main_data_id,
@@ -352,8 +350,7 @@ UNION
   WHERE
     valid_until_timestamp IS NOT NULL);
 
-DROP VIEW experiment_history_view;
-CREATE VIEW experiment_history_view AS (
+CREATE OR REPLACE VIEW experiment_history_view AS (
   SELECT
     2*id as id,
     main_expe_id,
-- 
GitLab