From 74e035d64bfb23945d2a239dcc95a5c28263a552 Mon Sep 17 00:00:00 2001 From: James Glover Date: Tue, 21 Jun 2016 13:57:22 +0100 Subject: [PATCH 1/2] Update mysql gem for 5.7 support --- Gemfile | 2 +- Gemfile.lock | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Gemfile b/Gemfile index 4106d774..463421e7 100644 --- a/Gemfile +++ b/Gemfile @@ -2,7 +2,7 @@ source 'https://rubygems.org' # TODO: We pretty much just use active record and active mailer, do we need rails? gem "rails", "~> 4.1" -gem "mysql2" +gem "mysql2", "~> 0.3.17" # TODO: COnsider switching to Bunny if possible gem "amqp", "~> 1.5" diff --git a/Gemfile.lock b/Gemfile.lock index aca2094e..c72ab9c0 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -88,7 +88,7 @@ GEM sinatra (~> 1.3) webmock (~> 1.8) multi_json (1.10.1) - mysql2 (0.3.16) + mysql2 (0.3.21) netrc (0.7.7) pry (0.10.1) coderay (~> 1.1.0) @@ -179,7 +179,7 @@ DEPENDENCIES hashie (~> 3.3) migration_comments mocktra (~> 1.0.2) - mysql2 + mysql2 (~> 0.3.17) psd_logger! rails (~> 4.1) rest-client From cc564b7da04d400eb74ee6e4afad760e44b34b6f Mon Sep 17 00:00:00 2001 From: James Glover Date: Wed, 10 Aug 2016 11:28:13 +0100 Subject: [PATCH 2/2] ss487 Ad migration to standardise encodings --- ..._unify_character_encoding_of_all_tables.rb | 73 +++++++ db/structure.sql | 187 +++++++++--------- 2 files changed, 167 insertions(+), 93 deletions(-) create mode 100644 db/migrate/20160810093024_unify_character_encoding_of_all_tables.rb diff --git a/db/migrate/20160810093024_unify_character_encoding_of_all_tables.rb b/db/migrate/20160810093024_unify_character_encoding_of_all_tables.rb new file mode 100644 index 00000000..548c5b99 --- /dev/null +++ b/db/migrate/20160810093024_unify_character_encoding_of_all_tables.rb @@ -0,0 +1,73 @@ +class UnifyCharacterEncodingOfAllTables < ActiveRecord::Migration + + # SQL provided by David Harper + + def up + psd_only = ENV['PSD_ONLY'] + say "Updating PSD tables only" if psd_only + + say "Updating database defaults" + ActiveRecord::Base.connection.execute("ALTER DATABASE CHARACTER SET = 'utf8' COLLATE = 'utf8_unicode_ci';") + say "Updating flgen_plate" + ActiveRecord::Base.connection.execute("ALTER TABLE `flgen_plate` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + say "Updating iseq_flowcell" + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_flowcell` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + say "Updating pac_bio_run" + ActiveRecord::Base.connection.execute("ALTER TABLE `pac_bio_run` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + say "Updating sample" + ActiveRecord::Base.connection.execute("ALTER TABLE `sample` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + say "Updating schema_migrations" + ActiveRecord::Base.connection.execute("ALTER TABLE `schema_migrations` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + say "Updating study" + ActiveRecord::Base.connection.execute("ALTER TABLE `study` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + say "Updating study_users" + ActiveRecord::Base.connection.execute("ALTER TABLE `study_users` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + + unless psd_only + say "Updating non psd tables" + say "Updating iseq_product_metrics",true + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_product_metrics` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + say "Updating iseq_run_lane_metrics",true + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_run_lane_metrics` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + say "Updating iseq_run_status",true + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_run_status` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + say "Updating iseq_run_status_dict",true + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_run_status_dict` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_unicode_ci';") + end + end + + def down + psd_only = ENV['PSD_ONLY'] + say "Restoring PSD tables only" if psd_only + + say "Restoring database defaults" + ActiveRecord::Base.connection.execute("ALTER DATABASE CHARACTER SET = 'latin1' COLLATE = 'latin1_swedish_ci';") + + say "Restoring flgen_plate" + ActiveRecord::Base.connection.execute("ALTER TABLE `flgen_plate` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + say "Restoring iseq_flowcell" + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_flowcell` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + say "Restoring pac_bio_run" + ActiveRecord::Base.connection.execute("ALTER TABLE `pac_bio_run` CONVERT TO CHARACTER SET 'latin1' COLLATE 'latin1_swedish_ci';") + say "Restoring sample" + ActiveRecord::Base.connection.execute("ALTER TABLE `sample` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + say "Restoring schema_migrations" + ActiveRecord::Base.connection.execute("ALTER TABLE `schema_migrations` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + say "Restoring study" + ActiveRecord::Base.connection.execute("ALTER TABLE `study` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + say "Restoring study_users" + ActiveRecord::Base.connection.execute("ALTER TABLE `study_users` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + + unless psd_only + say "Restoring non psd tables" + say "Restoring iseq_product_metrics" + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_product_metrics` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + say "Restoring iseq_run_lane_metrics" + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_run_lane_metrics` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + say "Restoring iseq_run_status" + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_run_status` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + say "Restoring iseq_run_status_dict" + ActiveRecord::Base.connection.execute("ALTER TABLE `iseq_run_status_dict` CONVERT TO CHARACTER SET 'utf8' COLLATE 'utf8_general_ci';") + end + end +end diff --git a/db/structure.sql b/db/structure.sql index 4bf14661..f6282ad6 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -1,8 +1,8 @@ --- MySQL dump 10.13 Distrib 5.6.13, for osx10.8 (x86_64) +-- MySQL dump 10.13 Distrib 5.7.12, for osx10.9 (x86_64) -- -- Host: localhost Database: unified_warehouse_development -- ------------------------------------------------------ --- Server version 5.6.13 +-- Server version 5.7.12 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; @@ -26,18 +26,18 @@ CREATE TABLE `flgen_plate` ( `id_flgen_plate_tmp` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Internal to this database id, value can change', `id_sample_tmp` int(10) unsigned NOT NULL COMMENT 'Sample id, see "sample.id_sample_tmp"', `id_study_tmp` int(10) unsigned NOT NULL COMMENT 'Study id, see "study.id_study_tmp"', - `cost_code` varchar(20) NOT NULL COMMENT 'Valid WTSI cost code', - `id_lims` varchar(10) NOT NULL COMMENT 'LIM system identifier, e.g. CLARITY-GCLP, SEQSCAPE', + `cost_code` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Valid WTSI cost code', + `id_lims` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'LIM system identifier, e.g. CLARITY-GCLP, SEQSCAPE', `last_updated` datetime NOT NULL COMMENT 'Timestamp of last update', `recorded_at` datetime NOT NULL COMMENT 'Timestamp of warehouse update', `plate_barcode` int(10) unsigned NOT NULL COMMENT 'Manufacturer (Fluidigm) chip barcode', - `plate_barcode_lims` varchar(128) DEFAULT NULL COMMENT 'LIMs-specific plate barcode', - `plate_uuid_lims` varchar(36) DEFAULT NULL COMMENT 'LIMs-specific plate uuid', - `id_flgen_plate_lims` varchar(20) NOT NULL COMMENT 'LIMs-specific plate id', + `plate_barcode_lims` varchar(128) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'LIMs-specific plate barcode', + `plate_uuid_lims` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'LIMs-specific plate uuid', + `id_flgen_plate_lims` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'LIMs-specific plate id', `plate_size` smallint(6) DEFAULT NULL COMMENT 'Total number of wells on a plate', `plate_size_occupied` smallint(6) DEFAULT NULL COMMENT 'Number of occupied wells on a plate', - `well_label` varchar(10) NOT NULL COMMENT 'Manufactuer well identifier within a plate, S001-S192', - `well_uuid_lims` varchar(36) DEFAULT NULL COMMENT 'LIMs-specific well uuid', + `well_label` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Manufactuer well identifier within a plate, S001-S192', + `well_uuid_lims` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'LIMs-specific well uuid', `qc_state` tinyint(1) DEFAULT NULL COMMENT 'QC state; 1 (pass), 0 (fail), NULL (not known)', PRIMARY KEY (`id_flgen_plate_tmp`), KEY `flgen_plate_id_lims_id_flgen_plate_lims_index` (`id_lims`,`id_flgen_plate_lims`), @@ -45,7 +45,7 @@ CREATE TABLE `flgen_plate` ( KEY `flgen_plate_study_fk` (`id_study_tmp`), CONSTRAINT `flgen_plate_sample_fk` FOREIGN KEY (`id_sample_tmp`) REFERENCES `sample` (`id_sample_tmp`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `flgen_plate_study_fk` FOREIGN KEY (`id_study_tmp`) REFERENCES `study` (`id_study_tmp`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -61,39 +61,39 @@ CREATE TABLE `iseq_flowcell` ( `recorded_at` datetime NOT NULL COMMENT 'Timestamp of warehouse update', `id_sample_tmp` int(10) unsigned NOT NULL COMMENT 'Sample id, see "sample.id_sample_tmp"', `id_study_tmp` int(10) unsigned DEFAULT NULL COMMENT 'Study id, see "study.id_study_tmp"', - `cost_code` varchar(20) DEFAULT NULL COMMENT 'Valid WTSI cost code', + `cost_code` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Valid WTSI cost code', `is_r_and_d` tinyint(1) DEFAULT '0' COMMENT 'A boolean flag derived from cost code, flags RandD', - `id_lims` varchar(10) NOT NULL COMMENT 'LIM system identifier, e.g. CLARITY-GCLP, SEQSCAPE', + `id_lims` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'LIM system identifier, e.g. CLARITY-GCLP, SEQSCAPE', `priority` smallint(2) unsigned DEFAULT '1' COMMENT 'Priority', `manual_qc` tinyint(1) DEFAULT NULL COMMENT 'Manual QC decision, NULL for unknown', `external_release` tinyint(1) DEFAULT NULL COMMENT 'Defaults to manual qc value; can be changed by the user later', - `flowcell_barcode` varchar(15) DEFAULT NULL COMMENT 'Manufacturer flowcell barcode or other identifier', - `reagent_kit_barcode` varchar(30) DEFAULT NULL COMMENT 'The barcode for the reagent kit or cartridge', - `id_flowcell_lims` varchar(20) NOT NULL COMMENT 'LIMs-specific flowcell id, batch_id for Sequencescape', + `flowcell_barcode` varchar(15) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Manufacturer flowcell barcode or other identifier', + `reagent_kit_barcode` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The barcode for the reagent kit or cartridge', + `id_flowcell_lims` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'LIMs-specific flowcell id, batch_id for Sequencescape', `position` smallint(2) unsigned NOT NULL COMMENT 'Flowcell lane number', - `entity_type` varchar(30) NOT NULL COMMENT 'Lane type: library, pool, library_control, library_indexed, library_indexed_spike', - `entity_id_lims` varchar(20) NOT NULL COMMENT 'Most specific LIMs identifier associated with this lane or plex or spike', + `entity_type` varchar(30) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Lane type: library, pool, library_control, library_indexed, library_indexed_spike', + `entity_id_lims` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Most specific LIMs identifier associated with this lane or plex or spike', `tag_index` smallint(5) unsigned DEFAULT NULL COMMENT 'Tag index, NULL if lane is not a pool', - `tag_sequence` varchar(30) DEFAULT NULL COMMENT 'Tag sequence', - `tag_set_id_lims` varchar(20) DEFAULT NULL COMMENT 'LIMs-specific identifier of the tag set', - `tag_set_name` varchar(100) DEFAULT NULL COMMENT 'WTSI-wide tag set name', - `tag_identifier` varchar(30) DEFAULT NULL COMMENT 'The position of tag within the tag group', - `tag2_sequence` varchar(30) DEFAULT NULL COMMENT 'Tag sequence for tag 2', - `tag2_set_id_lims` varchar(20) DEFAULT NULL COMMENT 'LIMs-specific identifier of the tag set for tag 2', - `tag2_set_name` varchar(100) DEFAULT NULL COMMENT 'WTSI-wide tag set name for tag 2', - `tag2_identifier` varchar(30) DEFAULT NULL COMMENT 'The position of tag2 within the tag group', + `tag_sequence` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Tag sequence', + `tag_set_id_lims` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'LIMs-specific identifier of the tag set', + `tag_set_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'WTSI-wide tag set name', + `tag_identifier` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The position of tag within the tag group', + `tag2_sequence` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Tag sequence for tag 2', + `tag2_set_id_lims` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'LIMs-specific identifier of the tag set for tag 2', + `tag2_set_name` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'WTSI-wide tag set name for tag 2', + `tag2_identifier` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The position of tag2 within the tag group', `is_spiked` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'Boolean flag indicating presence of a spike', - `pipeline_id_lims` varchar(60) DEFAULT NULL COMMENT 'LIMs-specific pipeline identifier that unambiguously defines library type', - `bait_name` varchar(50) DEFAULT NULL COMMENT 'WTSI-wide name that uniquely identifies a bait set', + `pipeline_id_lims` varchar(60) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'LIMs-specific pipeline identifier that unambiguously defines library type', + `bait_name` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'WTSI-wide name that uniquely identifies a bait set', `requested_insert_size_from` int(5) unsigned DEFAULT NULL COMMENT 'Requested insert size min value', `requested_insert_size_to` int(5) unsigned DEFAULT NULL COMMENT 'Requested insert size max value', `forward_read_length` smallint(4) unsigned DEFAULT NULL COMMENT 'Requested forward read length, bp', `reverse_read_length` smallint(4) unsigned DEFAULT NULL COMMENT 'Requested reverse read length, bp', - `id_pool_lims` varchar(20) NOT NULL COMMENT 'Most specific LIMs identifier associated with the pool', + `id_pool_lims` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'Most specific LIMs identifier associated with the pool', `legacy_library_id` int(11) DEFAULT NULL COMMENT 'Legacy library_id for backwards compatibility.', - `id_library_lims` varchar(255) DEFAULT NULL COMMENT 'Earliest LIMs identifier associated with library creation', - `team` varchar(255) DEFAULT NULL COMMENT 'The team responsible for creating the flowcell', - `purpose` varchar(30) DEFAULT NULL COMMENT 'Describes the reason the sequencing was conducted. Eg. Standard, QC, Control', + `id_library_lims` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Earliest LIMs identifier associated with library creation', + `team` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The team responsible for creating the flowcell', + `purpose` varchar(30) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'Describes the reason the sequencing was conducted. Eg. Standard, QC, Control', PRIMARY KEY (`id_iseq_flowcell_tmp`), KEY `iseq_flowcell_id_lims_id_flowcell_lims_index` (`id_lims`,`id_flowcell_lims`), KEY `iseq_flowcell_sample_fk` (`id_sample_tmp`), @@ -104,7 +104,7 @@ CREATE TABLE `iseq_flowcell` ( KEY `index_iseqflowcell__flowcell_barcode__position__tag_index` (`flowcell_barcode`,`position`,`tag_index`), CONSTRAINT `iseq_flowcell_sample_fk` FOREIGN KEY (`id_sample_tmp`) REFERENCES `sample` (`id_sample_tmp`) ON DELETE NO ACTION ON UPDATE NO ACTION, CONSTRAINT `iseq_flowcell_study_fk` FOREIGN KEY (`id_study_tmp`) REFERENCES `study` (`id_study_tmp`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -154,42 +154,42 @@ DROP TABLE IF EXISTS `sample`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `sample` ( `id_sample_tmp` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Internal to this database id, value can change', - `id_lims` varchar(10) NOT NULL COMMENT 'LIM system identifier, e.g. CLARITY-GCLP, SEQSCAPE', - `uuid_sample_lims` varchar(36) DEFAULT NULL COMMENT 'LIMS-specific sample uuid', - `id_sample_lims` varchar(20) NOT NULL COMMENT 'LIMS-specific sample identifier', + `id_lims` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'LIM system identifier, e.g. CLARITY-GCLP, SEQSCAPE', + `uuid_sample_lims` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'LIMS-specific sample uuid', + `id_sample_lims` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'LIMS-specific sample identifier', `last_updated` datetime NOT NULL COMMENT 'Timestamp of last update', `recorded_at` datetime NOT NULL COMMENT 'Timestamp of warehouse update', `deleted_at` datetime DEFAULT NULL COMMENT 'Timestamp of sample deletion', `created` datetime DEFAULT NULL COMMENT 'Timestamp of sample creation', - `name` varchar(255) DEFAULT NULL, - `reference_genome` varchar(255) DEFAULT NULL, - `organism` varchar(255) DEFAULT NULL, - `accession_number` varchar(50) DEFAULT NULL, - `common_name` varchar(255) DEFAULT NULL, - `description` text, + `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `reference_genome` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `organism` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `accession_number` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `common_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text COLLATE utf8_unicode_ci, `taxon_id` int(6) unsigned DEFAULT NULL, - `father` varchar(255) DEFAULT NULL, - `mother` varchar(255) DEFAULT NULL, - `replicate` varchar(255) DEFAULT NULL, - `ethnicity` varchar(255) DEFAULT NULL, - `gender` varchar(20) DEFAULT NULL, - `cohort` varchar(255) DEFAULT NULL, - `country_of_origin` varchar(255) DEFAULT NULL, - `geographical_region` varchar(255) DEFAULT NULL, - `sanger_sample_id` varchar(255) DEFAULT NULL, + `father` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `mother` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `replicate` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ethnicity` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `gender` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL, + `cohort` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `country_of_origin` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `geographical_region` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `sanger_sample_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `control` tinyint(1) DEFAULT NULL, - `supplier_name` varchar(255) DEFAULT NULL, - `public_name` varchar(255) DEFAULT NULL, - `sample_visibility` varchar(255) DEFAULT NULL, - `strain` varchar(255) DEFAULT NULL, + `supplier_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `public_name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `sample_visibility` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `strain` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `consent_withdrawn` tinyint(1) NOT NULL DEFAULT '0', - `donor_id` varchar(255) DEFAULT NULL, + `donor_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id_sample_tmp`), UNIQUE KEY `index_sample_on_id_sample_lims_and_id_lims` (`id_sample_lims`,`id_lims`), UNIQUE KEY `sample_uuid_sample_lims_index` (`uuid_sample_lims`), KEY `sample_accession_number_index` (`accession_number`), KEY `sample_name_index` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -200,9 +200,9 @@ DROP TABLE IF EXISTS `schema_migrations`; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `schema_migrations` ( - `version` varchar(255) NOT NULL, + `version` varchar(255) COLLATE utf8_unicode_ci NOT NULL, UNIQUE KEY `unique_schema_migrations` (`version`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -214,49 +214,49 @@ DROP TABLE IF EXISTS `study`; /*!40101 SET character_set_client = utf8 */; CREATE TABLE `study` ( `id_study_tmp` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Internal to this database id, value can change', - `id_lims` varchar(10) NOT NULL COMMENT 'LIM system identifier, e.g. GCLP-CLARITY, SEQSCAPE', - `uuid_study_lims` varchar(36) DEFAULT NULL COMMENT 'LIMS-specific study uuid', - `id_study_lims` varchar(20) NOT NULL COMMENT 'LIMS-specific study identifier', + `id_lims` varchar(10) COLLATE utf8_unicode_ci NOT NULL COMMENT 'LIM system identifier, e.g. GCLP-CLARITY, SEQSCAPE', + `uuid_study_lims` varchar(36) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'LIMS-specific study uuid', + `id_study_lims` varchar(20) COLLATE utf8_unicode_ci NOT NULL COMMENT 'LIMS-specific study identifier', `last_updated` datetime NOT NULL COMMENT 'Timestamp of last update', `recorded_at` datetime NOT NULL COMMENT 'Timestamp of warehouse update', `deleted_at` datetime DEFAULT NULL COMMENT 'Timestamp of study deletion', `created` datetime DEFAULT NULL COMMENT 'Timestamp of study creation', - `name` varchar(255) DEFAULT NULL, - `reference_genome` varchar(255) DEFAULT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `reference_genome` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `ethically_approved` tinyint(1) DEFAULT NULL, - `faculty_sponsor` varchar(255) DEFAULT NULL, - `state` varchar(50) DEFAULT NULL, - `study_type` varchar(50) DEFAULT NULL, - `abstract` text, - `abbreviation` varchar(255) DEFAULT NULL, - `accession_number` varchar(50) DEFAULT NULL, - `description` text, + `faculty_sponsor` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `state` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `study_type` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `abstract` text COLLATE utf8_unicode_ci, + `abbreviation` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `accession_number` varchar(50) COLLATE utf8_unicode_ci DEFAULT NULL, + `description` text COLLATE utf8_unicode_ci, `contains_human_dna` tinyint(1) DEFAULT NULL COMMENT 'Lane may contain human DNA', `contaminated_human_dna` tinyint(1) DEFAULT NULL COMMENT 'Human DNA in the lane is a contaminant and should be removed', - `data_release_strategy` varchar(255) DEFAULT NULL, - `data_release_sort_of_study` varchar(255) DEFAULT NULL, - `ena_project_id` varchar(255) DEFAULT NULL, - `study_title` varchar(255) DEFAULT NULL, - `study_visibility` varchar(255) DEFAULT NULL, - `ega_dac_accession_number` varchar(255) DEFAULT NULL, - `array_express_accession_number` varchar(255) DEFAULT NULL, - `ega_policy_accession_number` varchar(255) DEFAULT NULL, - `data_release_timing` varchar(255) DEFAULT NULL, - `data_release_delay_period` varchar(255) DEFAULT NULL, - `data_release_delay_reason` varchar(255) DEFAULT NULL, + `data_release_strategy` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `data_release_sort_of_study` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ena_project_id` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `study_title` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `study_visibility` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ega_dac_accession_number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `array_express_accession_number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `ega_policy_accession_number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `data_release_timing` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `data_release_delay_period` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `data_release_delay_reason` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, `remove_x_and_autosomes` tinyint(1) NOT NULL DEFAULT '0', `aligned` tinyint(1) NOT NULL DEFAULT '1', `separate_y_chromosome_data` tinyint(1) NOT NULL DEFAULT '0', - `data_access_group` varchar(255) DEFAULT NULL, - `prelim_id` varchar(20) DEFAULT NULL COMMENT 'The preliminary study id prior to entry into the LIMS', - `hmdmc_number` varchar(255) DEFAULT NULL COMMENT 'The Human Materials and Data Management Committee approval number(s) for the study.', - `data_destination` varchar(255) DEFAULT NULL COMMENT 'The data destination type(s) for the study. It could be ''standard'', ''14mg'' or ''gseq''. This may be extended, if Sanger gains more external customers. It can contain multiply destinations separated by a space.', + `data_access_group` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `prelim_id` varchar(20) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The preliminary study id prior to entry into the LIMS', + `hmdmc_number` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The Human Materials and Data Management Committee approval number(s) for the study.', + `data_destination` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT 'The data destination type(s) for the study. It could be ''standard'', ''14mg'' or ''gseq''. This may be extended, if Sanger gains more external customers. It can contain multiply destinations separated by a space.', PRIMARY KEY (`id_study_tmp`), UNIQUE KEY `study_id_lims_id_study_lims_index` (`id_lims`,`id_study_lims`), UNIQUE KEY `study_uuid_study_lims_index` (`uuid_study_lims`), KEY `study_accession_number_index` (`accession_number`), KEY `study_name_index` (`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; -- @@ -270,14 +270,14 @@ CREATE TABLE `study_users` ( `id_study_users_tmp` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Internal to this database id, value can change', `id_study_tmp` int(10) unsigned NOT NULL COMMENT 'Study id, see "study.id_study_tmp"', `last_updated` datetime NOT NULL COMMENT 'Timestamp of last update', - `role` varchar(255) DEFAULT NULL, - `login` varchar(255) DEFAULT NULL, - `email` varchar(255) DEFAULT NULL, - `name` varchar(255) DEFAULT NULL, + `role` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `login` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `email` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, + `name` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL, PRIMARY KEY (`id_study_users_tmp`), KEY `study_users_study_fk` (`id_study_tmp`), CONSTRAINT `study_users_study_fk` FOREIGN KEY (`id_study_tmp`) REFERENCES `study` (`id_study_tmp`) ON DELETE NO ACTION ON UPDATE NO ACTION -) ENGINE=InnoDB DEFAULT CHARSET=utf8; +) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; /*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; @@ -289,8 +289,7 @@ CREATE TABLE `study_users` ( /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2016-04-22 13:25:56 - +-- Dump completed on 2016-08-10 11:13:37 INSERT INTO schema_migrations (version) VALUES ('20141113110635'); INSERT INTO schema_migrations (version) VALUES ('20141113130813'); @@ -337,3 +336,5 @@ INSERT INTO schema_migrations (version) VALUES ('20160420084130'); INSERT INTO schema_migrations (version) VALUES ('20160422095926'); +INSERT INTO schema_migrations (version) VALUES ('20160810093024'); +