class UpdateMasterSectionIdInTranscriptSections < ActiveRecord::Migration[7.0]
  def up
    TranscriptSection.where(master_section_id: nil).find_each do |transcript_section|
      master_section = MasterSection.find_by(name: transcript_section.name)
      transcript_section.update(master_section_id: master_section.id) if master_section
    end
  end

  def down
    # You can define the rollback logic here if necessary.
    raise ActiveRecord::IrreversibleMigration
  end
end
