diff --git a/misc-scripts/ontology/sql/patch_71_72b.sql b/misc-scripts/ontology/sql/patch_71_72_b.sql similarity index 88% rename from misc-scripts/ontology/sql/patch_71_72b.sql rename to misc-scripts/ontology/sql/patch_71_72_b.sql index fcbdb8aadcf00d10668794b9db112e2186cfd359..2f88708434f448f090f0e3aca16160c6151f3eac 100644 --- a/misc-scripts/ontology/sql/patch_71_72b.sql +++ b/misc-scripts/ontology/sql/patch_71_72_b.sql @@ -12,4 +12,4 @@ CREATE TABLE alt_id ( -- Patch identifier INSERT INTO meta (meta_key, meta_value) - VALUES ('patch', 'patch_71_72b.sql|alt_id table'); + VALUES ('patch', 'patch_71_72_b.sql|alt_id table'); diff --git a/misc-scripts/ontology/sql/patch_71_72c.sql b/misc-scripts/ontology/sql/patch_71_72_c.sql similarity index 79% rename from misc-scripts/ontology/sql/patch_71_72c.sql rename to misc-scripts/ontology/sql/patch_71_72_c.sql index 12bde7d38a39d1d29e51ba3410f9594a5521e26d..721f793fab11dc3572687fe749a8c513d092b5f2 100644 --- a/misc-scripts/ontology/sql/patch_71_72c.sql +++ b/misc-scripts/ontology/sql/patch_71_72_c.sql @@ -1,4 +1,4 @@ --- patch_71_72c.sql +-- patch_71_72_c.sql -- -- Title: Insert schema version. -- @@ -11,6 +11,6 @@ INSERT INTO meta (meta_key, meta_value) -- Patch identifier INSERT INTO meta (meta_key, meta_value) - VALUES ('patch', 'patch_71_72c.sql|schema_version'); + VALUES ('patch', 'patch_71_72_c.sql|schema_version'); diff --git a/misc-scripts/ontology/sql/patch_71_72_d.sql b/misc-scripts/ontology/sql/patch_71_72_d.sql new file mode 100644 index 0000000000000000000000000000000000000000..27594dd3f81534676b9806116a0cb69b24d5f60f --- /dev/null +++ b/misc-scripts/ontology/sql/patch_71_72_d.sql @@ -0,0 +1,20 @@ +-- patch_71_72_d.sql +-- +-- Title: Fix patch versions +-- +-- Description: +-- Fixes the existing patch meta items as their versioning was not correct + +update meta set meta_value = 'patch_71_72_b.sql|alt_id table' + where meta_key = 'patch' + and meta_value = 'patch_71_72b.sql|alt_id table'; + +update meta set meta_value = 'patch_71_72_c.sql|schema_version' + where meta_key = 'patch' + and meta_value = 'patch_71_72c.sql|schema_version'; + +-- Patch identifier +INSERT INTO meta (meta_key, meta_value) + VALUES ('patch', 'patch_71_72_d.sql|patch_version_fix'); + + diff --git a/misc-scripts/ontology/sql/patch_71_72_e.sql b/misc-scripts/ontology/sql/patch_71_72_e.sql new file mode 100644 index 0000000000000000000000000000000000000000..902cc08fce6fe488822d4ae73dcb9b4f79b28a2f --- /dev/null +++ b/misc-scripts/ontology/sql/patch_71_72_e.sql @@ -0,0 +1,15 @@ +-- patch_71_72_e.sql +-- +-- Title: Add is_obsolete +-- +-- Description: +-- Adds the is_obsolete flag to the term table + +ALTER TABLE TERM +ADD COLUMN is_obsolete INT NOT NULL DEFAULT 0; + +-- Patch identifier +INSERT INTO meta (meta_key, meta_value) + VALUES ('patch', 'patch_71_72_e.sql|is_obsolete'); + + diff --git a/misc-scripts/ontology/sql/tables.sql b/misc-scripts/ontology/sql/tables.sql index 68e1f6b877205510e2acbf3441ca01647f07b5ec..495c341bcf308add984d3996e15859c670f960bf 100644 --- a/misc-scripts/ontology/sql/tables.sql +++ b/misc-scripts/ontology/sql/tables.sql @@ -22,6 +22,10 @@ INSERT INTO meta (meta_key, meta_value) VALUES ('patch', 'patch_71_72b.sql|alt_id table'); INSERT INTO meta (meta_key, meta_value) VALUES ('patch', 'patch_71_72c.sql|schema_version'); +INSERT INTO meta (meta_key, meta_value) + VALUES ('patch', 'patch_71_72_d.sql|patch_version_fix'); +INSERT INTO meta (meta_key, meta_value) + VALUES ('patch', 'patch_71_72_e.sql|is_obsolete'); CREATE TABLE ontology ( ontology_id INT UNSIGNED NOT NULL AUTO_INCREMENT, @@ -48,8 +52,8 @@ CREATE TABLE term ( accession VARCHAR(64) NOT NULL, name VARCHAR(255) NOT NULL, definition TEXT, - is_root INT, - is_obsolete INT, + is_root INT NOT NULL DEFAULT 0, + is_obsolete INT NOT NULL DEFAULT 0, PRIMARY KEY (term_id), UNIQUE INDEX accession_idx (accession),