Sha256: da4642b60c7071e800a50006a27084ca93eb17dc680921158f992709bc3e57ab

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

class CreatePosts < ActiveRecord::Migration
  def self.up
    create_table :posts do |t|
      t.column :user_id, :int
      t.column :slug, :string, :limit => 150
      t.column :title, :string
      t.column :content, :text
      t.column :published, :boolean, :default => false
      t.column :views, :int, :default => '0'
      t.timestamps
    end
    
    Post.create({
      :user_id=>0,
      :title=>"Welcome post", 
      :content=>"First post content ... <hr />", 
      :published=>true
    })
  end

  def self.down
    drop_table :posts
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
santey_blog-0.1.2 lib/generators/templates/migrations/create_posts.rb