From b6b45dfc5df0b1348e2335f6b80360870c83c1c1 Mon Sep 17 00:00:00 2001
From: tpylak <tpylak>
Date: Wed, 16 Feb 2011 09:00:48 +0000
Subject: [PATCH] LMS-2044 add unknown file type

SVN: 19998
---
 .../postgresql/migration/migration-065-066.sql  | 17 +++++++++++++++++
 .../dist/admin/empty-screening-database.sql     | 11 +++++++++++
 2 files changed, 28 insertions(+)

diff --git a/openbis/source/sql/postgresql/migration/migration-065-066.sql b/openbis/source/sql/postgresql/migration/migration-065-066.sql
index d237ebae1ef..b6b00882956 100644
--- a/openbis/source/sql/postgresql/migration/migration-065-066.sql
+++ b/openbis/source/sql/postgresql/migration/migration-065-066.sql
@@ -78,6 +78,7 @@ $$ LANGUAGE 'plpgsql';
 CREATE OR REPLACE FUNCTION CREATE_HCS_DATASET_TYPES() RETURNS void AS $$
 DECLARE
 	hcs_image_dataset_exists bool;
+	unknown_file_format_exists bool;
 BEGIN
 	
 	select true 
@@ -90,6 +91,22 @@ BEGIN
 		return;
 	end if;   
 	
+	-- insert unknown file format if it is not yet present -- 
+	select true into unknown_file_format_exists from file_format_types where code = 'UNKNOWN';
+	if unknown_file_format_exists IS NULL then 
+			insert into file_format_types(
+				id, 
+				code, 
+				description,
+				dbin_id) 
+			values(
+				nextval('file_format_type_id_seq'), 
+				'UNKNOWN', 
+				'Unknown file format',
+				(select id from database_instances where is_original_source = 'T')
+			);	
+	end if;   
+	
 	PERFORM INSERT_DATASET_TYPE_IF_NOT_PRESENT(
 			'HCS_IMAGE_RAW',	
 			'Raw High Content Screening Images');
diff --git a/screening/dist/admin/empty-screening-database.sql b/screening/dist/admin/empty-screening-database.sql
index 6e693f45c2a..f4e97571e9b 100644
--- a/screening/dist/admin/empty-screening-database.sql
+++ b/screening/dist/admin/empty-screening-database.sql
@@ -2247,6 +2247,17 @@ COPY file_format_types (id, code, description, dbin_id) FROM stdin;
 9	JPG	\N	1
 \.
 
+insert into file_format_types(
+	id, 
+	code, 
+	description,
+	dbin_id) 
+values(
+	nextval('file_format_type_id_seq'), 
+	'UNKNOWN', 
+	'Unknown file format',
+	(select id from database_instances where is_original_source = 'T')
+);	
 
 --
 -- Data for Name: filters; Type: TABLE DATA; Schema: public; Owner: -
-- 
GitLab