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: 20170412103617_transform_tax_rate_category_relation.rb
    path of file: ./repos/solidus/core/db/migrate
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

class TransformTaxRateCategoryRelation < ActiveRecord::Migration[5.0]
  class TaxRate < ActiveRecord::Base
    self.table_name = "spree_tax_rates"
  end

  class TaxRateTaxCategory < ActiveRecord::Base
    self.table_name = "spree_tax_rate_tax_categories"
  end

  def up
    create_table :spree_tax_rate_tax_categories do |t|
      t.integer :tax
    
  def up
    create_table :spree_tax_rate_tax_categories do |t|
      t.integer :tax_category_id, index: true, null: false
      t.integer :tax_rate_id, index: true, null: false
    end

    add_foreign_key :spree_tax_rate_tax_categories, :spree_tax_categories, column: :tax_category_id
    add_foreign_key :spree_tax_rate_tax_categories, :spree_tax_rates, column: :tax_rate_id

    TaxRate.where.not(tax_category_id: nil).find_each do |tax_rate|
      TaxRateTaxCategory.create!(
        tax_rate_id: tax_rate.id,
        tax_category_id: tax_rate.tax_category_id
      )
    end

    remove_column :spree_tax_rates, :tax_category_id
  end