Created
May 30, 2011 18:52
-
-
Save wjessop/999311 to your computer and use it in GitHub Desktop.
Posts migration
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 CreatePosts < ActiveRecord::Migration | |
def self.up | |
create_table :posts do |t| | |
t.string :title, :null => false | |
t.text :body | |
t.string :author, :null => false, :default => "Anonymous" | |
t.timestamps | |
end | |
add_index :posts, :author | |
end | |
def self.down | |
drop_table :posts | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment