Skip to content

Instantly share code, notes, and snippets.

@roloenusa
Created July 25, 2011 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roloenusa/1103598 to your computer and use it in GitHub Desktop.
Save roloenusa/1103598 to your computer and use it in GitHub Desktop.
Ruby: Adding a column to a existing table.
# -- 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