class UpdateUsdaFoods < ActiveRecord::Migration[5.2]

  class UsdaFoodMigrate < ActiveRecord::Base
    self.table_name = :usda_foods
  end

  def change
    add_column :usda_foods, :source, :string, index: true
    add_column :usda_foods, :manufacturer, :string
    add_column :usda_foods, :ingredients, :text
    add_column :usda_foods, :nutrient_unit, :string

    UsdaFoodMigrate.reset_column_information

    UsdaFoodMigrate.update_all(nutrient_unit: '100 grams')
  end
end
