From 701107b32ebd9c15612279c667d7cd41ccb84d89 Mon Sep 17 00:00:00 2001
From: felmer <felmer>
Date: Tue, 15 Feb 2011 08:30:18 +0000
Subject: [PATCH] removed stuff added again

SVN: 19943
---
 .../migration/migration-065-066.sql           | 40 +++++++++++++++++++
 1 file changed, 40 insertions(+)

diff --git a/openbis/source/sql/postgresql/migration/migration-065-066.sql b/openbis/source/sql/postgresql/migration/migration-065-066.sql
index 3d95d3cfa11..d237ebae1ef 100644
--- a/openbis/source/sql/postgresql/migration/migration-065-066.sql
+++ b/openbis/source/sql/postgresql/migration/migration-065-066.sql
@@ -1,5 +1,45 @@
 -- Migration from 065 to 066
 
+
+ALTER TABLE EXTERNAL_DATA ADD COLUMN SHARE_ID CODE;
+ALTER TABLE EXTERNAL_DATA ADD COLUMN SIZE ORDINAL_INT;
+
+----------------------------------------------------------------------------------------------------
+-- Redo part of migration from 056 to 057
+--
+-- Introduction of a new data type - XML, was done in migration but data.sql wasn't updated.
+-- Add the XML data type it if it doesn't exist.
+----------------------------------------------------------------------------------------------------
+
+CREATE OR REPLACE FUNCTION insert_xml_data_type_if_not_exists() RETURNS void AS $$
+DECLARE
+	exists bool;
+BEGIN
+    SELECT true INTO exists
+    FROM data_types WHERE code = 'XML';
+    
+    IF exists IS NULL then
+       -- XML data type doesn't exist - insert it
+       INSERT INTO data_types (id, code, description) 
+              VALUES (nextval('data_type_id_seq'), 'XML', 'XML document');
+    END IF;	
+END;
+$$ LANGUAGE 'plpgsql';
+
+
+SELECT insert_xml_data_type_if_not_exists();
+DROP FUNCTION insert_xml_data_type_if_not_exists();
+
+----------------------------------------------------------------------------------------------------
+-- Redo part of migration from 063 to 064
+--
+-- Domain SCRIPT_TYPE created in migration has different values than the one in domain.sql.
+-- Alter the domain.
+----------------------------------------------------------------------------------------------------
+
+ALTER DOMAIN script_type DROP CONSTRAINT script_type_check;
+ALTER DOMAIN script_type ADD CONSTRAINT script_type_check CHECK (VALUE IN ('DYNAMIC_PROPERTY', 'MANAGED_PROPERTY'));
+
 --------------------------------------------------------------------------------------
 --------------------------------------------------------------------------------------
 -- This is a screening specific migration. Nothing will be performed on openBIS databases 
-- 
GitLab