We Recommend

The Rails Way The Rails Way
Now, for the first time, there’s a comprehensive, authoritative guide to building production-quality software with Rails. Pioneering Rails developer Obie Fernandez and a team of experts illuminate the entire Rails API, along with the Ruby idioms, design approaches, libraries, and plug-ins that make Rails so valuable.


Posted By

jpowell on 05/25/07


Tagged

table textmate rails migration create rake migrate


Versions (?)


Rake Migrate Migrations Create Table Example


Published in: Rails 


  1. class AddEntriesTable < ActiveRecord::Migration
  2. def self.up
  3. create_table :entries do |table|
  4. table.column :title, :string
  5. table.column :content, :text
  6. table.column :created_at, :datetime
  7. end
  8. end
  9.  
  10. def self.down
  11. drop_table :entries
  12. end
  13. end

Report this snippet 

You need to login to post a comment.