Created
March 27, 2011 15:07
-
-
Save gertig/889280 to your computer and use it in GitHub Desktop.
devise_invitable migration file if adding to existing Model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DeviseInvitableAddToUsers < ActiveRecord::Migration | |
def self.up | |
change_table :users do |t| | |
t.string :invitation_token, :limit => 60 | |
t.datetime :invitation_sent_at | |
t.index :invitation_token | |
t.integer :invitation_limit | |
t.integer :invited_by_id | |
t.string :invited_by_type | |
end | |
# And allow null encrypted_password and password_salt: | |
change_column :users, :encrypted_password, :string, :null => true | |
change_column :users, :password_salt, :string, :null => true | |
end | |
def self.down | |
remove_column :users, :invited_by_type | |
remove_column :users, :invited_by_id | |
remove_column :users, :invitation_limit | |
remove_column :users, :invitation_sent_at | |
remove_column :users, :invitation_token | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment