parsley/db/migrate/20180912172758_add_is_ingredient_to_recipe.rb

15 lines
329 B
Ruby
Raw Normal View History

2018-09-12 14:17:18 -05:00
class AddIsIngredientToRecipe < ActiveRecord::Migration[5.2]
class RecipeMigrator < ActiveRecord::Base
self.table_name = 'recipes'
end
def change
add_column :recipes, :is_ingredient, :boolean, index: true
RecipeMigrator.reset_column_information
RecipeMigrator.update_all(is_ingredient: false)
end
end