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: 045_menu_update_impersonate.rb
    path of file: ./repos/expertiza/db/migrate
    
    the code of the file until where you have to start completion: class MenuUpdateImpersonate < ActiveRecord::Migration[4.2]
  def self.up
    permission1 = Permission.find_by_name('administer assignments')
    permission2 = Permission.find_by_name('do assignments')
    site_controller = SiteControl
    
  def self.down
    site_controller = SiteController.find_by_name('impersonate')
    if site_controller
      controllers = ControllerAction.where(['site_controller_id = ?', site_controller.id])
      controllers.each do |controller|
        next unless controller

        menuItem = MenuItem.find_by_controller_action_id(controller.id)
        menuItem.destroy if menuItem
        controller.destroy
      end
      site_controller.destroy
    end