class DeleteTNANewURLs < ActiveRecord::Migration
  class Mapping < ActiveRecord::Base
    self.inheritance_column = nil
  end

  def up
    Mapping.where("new_url LIKE '%webarchive.nationalarchives%'").each do |mapping|
      if mapping.type == 'redirect'
        mapping.type = 'archive'
        mapping.archive_url = mapping.new_url
      end
      mapping.new_url = nil
      mapping.save
    end
  end

  def down
    # Nothing here because we don't want to put back invalid data.
  end
end

class DeleteTnaNewURLs < ActiveRecord::Migration
  class Mapping < ActiveRecord::Base
    self.inheritance_column = nil
  end

  def up
    Mapping.where("new_url LIKE '%webarchive.nationalarchives%'").each do |mapping|
      if mapping.type == 'redirect'
        mapping.type = 'archive'
        mapping.archive_url = mapping.new_url
      end
      mapping.new_url = nil
      mapping.save
    end
  end

  def down
    # Nothing here because we don't want to put back invalid data.
  end
end

Fix name of a migration class to not rely on inflection
Fix name of a migration class to not rely on inflection

This migration was failing because the class name was relying on
inflection of 'TNA', but that isn't loaded here. This reverts the
name to 'Tna' so that it runs.
