sanger / sequencescape

Web based LIMS
MIT License
85 stars 33 forks source link

Y24-373 - Data migration to update sample_metadata country_of_origin #4406

Open neilsycamore opened 2 days ago

neilsycamore commented 2 days ago

Two country_of_origin of options ("not applicable: control sample" and "not applicable: sample group") have been identified and Y24-372 created to change these.

The samples in the Sequencescape and MLWH databases requires updating to reflect the changes not applicable: control sample => missing: control sample not applicable: sample group => missing: sample group

neilsycamore commented 1 day ago

this method will update samples table in SS & MLWH

def update_country_of_origin(old_id,new_id)
  ActiveRecord::Base.transaction do
    data = Sample::Metadata.where(country_of_origin: old_id)
    data.each {|sm| sm.update!(country_of_origin: new_id)}
  end
end