You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: 20161208043524_enforce_department_shortname_required.rb
    path of file: ./repos/ReadyResponder/db/migrate
    
    the code of the file until where you have to start completion: class EnforceDepartmentShortnameRequired < ActiveRecord::Migration[4.2]
  def change
    
    # use raw sql to update any departments with null shortname
    Department.where(shortname: nil).update_all("shortname = name")
    
    # at
    
  def change
    
    # use raw sql to update any departments with null shortname
    Department.where(shortname: nil).update_all("shortname = name")
    
    # at this point, there may still be departments with nil name and shortname
    Department.where(shortname: nil).each_with_index {|d, i| d.update_columns(shortname: "dept_#{i}")}
    
    # finally, it should be safe to set shortname to null: false
    change_column :departments, :shortname, :string, null: false
  end