From d331748cc98bdbd047ddd4d4cd4518747db8d226 Mon Sep 17 00:00:00 2001
From: Will Spooner <whs@sanger.ac.uk>
Date: Thu, 31 May 2007 09:51:44 +0000
Subject: [PATCH] Added a source_external_db_id field to go_xref table

---
 sql/foreign_keys.sql  |  2 ++
 sql/patch_44_45_d.sql | 15 +++++++++++++++
 sql/table.sql         |  2 ++
 3 files changed, 19 insertions(+)
 create mode 100644 sql/patch_44_45_d.sql

diff --git a/sql/foreign_keys.sql b/sql/foreign_keys.sql
index 58c94b3bdd..d6d10390e0 100644
--- a/sql/foreign_keys.sql
+++ b/sql/foreign_keys.sql
@@ -56,6 +56,8 @@ ALTER table gene_stable_id ADD FOREIGN KEY (gene_id) REFERENCES gene(gene_id);
 
 ALTER table go_xref ADD FOREIGN KEY (object_xref_id) REFERENCES object_xref(object_xref_id);
 
+ALTER table go_xref ADD FOREIGN KEY (source_external_db_id) REFERENCES external_db(external_db_id);
+
 ALTER table identity_xref ADD FOREIGN KEY (analysis_id) REFERENCES analysis(analysis_id);
 ALTER table identity_xref ADD FOREIGN KEY (object_xref_id) REFERENCES object_xref(object_xref_id);
 
diff --git a/sql/patch_44_45_d.sql b/sql/patch_44_45_d.sql
new file mode 100644
index 0000000000..6f356cc72e
--- /dev/null
+++ b/sql/patch_44_45_d.sql
@@ -0,0 +1,15 @@
+# patch_44_45_d.sql
+#
+# title: go_xref_source_field
+#
+# description: 
+# Add a source_external_db_id field to go_xref table
+
+ALTER TABLE `go_xref` ADD COLUMN 
+  `source_external_db_id` int(10) unsigned default NULL;
+
+ALTER TABLE `go_xref` ADD KEY (source_external_db_id);
+
+# patch identifier
+INSERT INTO meta (meta_key, meta_value) 
+VALUES ('patch', 'patch_44_45_d.sql|go_xref_source_field');
diff --git a/sql/table.sql b/sql/table.sql
index 4874198d43..0b36cacdab 100755
--- a/sql/table.sql
+++ b/sql/table.sql
@@ -729,7 +729,9 @@ CREATE TABLE go_xref (
   linkage_type            ENUM('IC', 'IDA', 'IEA', 'IEP', 'IGI', 'IMP', 
 		               'IPI', 'ISS', 'NAS', 'ND', 'TAS', 'NR', 'RCA')
                           NOT NULL,
+  source_external_db_id   INT(10) UNSIGNED DEFAULT NULL,
   KEY (object_xref_id),
+  KEY (source_external_db_id),
   UNIQUE (object_xref_id, linkage_type)
 
 ) COLLATE=latin1_swedish_ci TYPE=MyISAM;
-- 
GitLab