Skip to content

Instantly share code, notes, and snippets.

@acuppy

acuppy/data-migrations.rb

Last active Jul 9, 2016
Embed
What would you like to do?
class AddAdminToUsers < ActiveRecord::Migration
def change
add_column :users, :admin, :boolean, default: false
# convert existing users to admin
User.reset_column_information
User.find_each do |u|
u.update admin: true
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment