-
-
Save roloenusa/1103598 to your computer and use it in GitHub Desktop.
Ruby: Adding a column to a existing table.
This file contains 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
# -- Look at the name "add password to the table Users" with a encrypted_password column | |
# rails generate migration add_password_to_users encrypted_password:string | |
class AddPasswordToUsers < ActiveRecord::Migration | |
def self.up | |
add_column :users, :encrypted_password, :string | |
end | |
def self.down | |
remove_column :users, :encrypted_password | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment