Rake Migrate Migrations Create Table Example


/ Published in: Rails
Save to your folder(s)



Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.