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: 20150521121315_rename_config_template_to_provisioning_template.rb
    path of file: ./repos/foreman/db/migrate
    
    the code of the file until where you have to start completion: class RenameConfigTemplateToProvisioningTemplate < ActiveRecord::Migration[4.2]
  def up
    %w(os_default_templates template_combinations config_templates_operatingsystems).each do |source_table|
      if foreign_key_exists?(s
    
  def down
    remove_foreign_key 'os_default_templates', :name => 'os_default_templates_provisioning_template_id_fk'
    remove_foreign_key 'template_combinations', :name => 'template_combinations_provisioning_template_id_fk'
    remove_foreign_key 'operatingsystems_provisioning_templates', :name => 'os_provisioning_template_id_fk'

    rename_column :template_combinations, :provisioning_template_id, :config_template_id
    rename_column :os_default_templates, :provisioning_template_id, :config_template_id

    rename_column :operatingsystems_provisioning_templates, :provisioning_template_id, :config_template_id
    rename_table :operatingsystems_provisioning_templates, :config_templates_operatingsystems

    add_foreign_key 'os_default_templates', 'config_templates', :name => 'os_default_templates_config_template_id_fk'
    add_foreign_key 'template_combinations', 'config_templates', :name => 'template_combinations_config_template_id_fk'
    add_foreign_key 'config_templates_operatingsystems', 'config_templates', :name => 'config_templates_operatingsystems_config_template_id_fk'
  end