Skip to content

Commit

Permalink
Merge pull request #40 from sanger/next_release
Browse files Browse the repository at this point in the history
release-1.6.0
  • Loading branch information
James Glover authored Oct 26, 2016
2 parents fae590f + 3a2cc61 commit 595796f
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 95 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddLibraryCreatedAtToPacBioRun < ActiveRecord::Migration
def change
change_table :pac_bio_run do |t|
t.datetime :library_created_at, null: true, comment: 'Timestamp of library creation'
end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
class AddPhenotypeColumnToSampleTable < ActiveRecord::Migration
def change
change_table :sample do |t|
t.string 'phenotype', comment: 'The phenotype of the sample as described in Sequencescape'
end
end
end
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 595796f

Please sign in to comment.