Skip to content

Instantly share code, notes, and snippets.

@traviskroberts
Last active December 17, 2015 03:19
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save traviskroberts/31d302f03da8816c2f9b to your computer and use it in GitHub Desktop.
class AddSingleAccessTokenToUser < ActiveRecord::Migration
def up
add_column :users, :single_access_token, :string
# need to set a value so we can update the column to :null => false
User.reset_column_information
User.all.each { |u| u.reset_single_access_token! }
change_column :users, :single_access_token, :string, :null => false
end
def down
remove_column :users, :single_access_token
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment