class Post < ActiveRecord::Base; end

class CreatePosts < ActiveRecord::Migration
  def self.up
    create_table :posts do |t|
      t.column :title, :string
      t.column :published_at, :datetime
      t.column :updated_at, :datetime
      t.column :content, :text
      t.column :content_type, :string
      t.column :author, :string
    end
    
    Post.new do |post|
      post.title = 'Rails Cookbook'
      post.updated_at = post.published_at = Time.now
      post.author = 'Christian'
      post.content = <<-ENDPOST
        <p>
          Rob Orsini's Rails Cookbook is out. Run, don't walk, 
          and get yourself a copy today!
        </p>
      ENDPOST
      post.content_type = 'text/xhtml'
      post.save
    end
  end

  def self.down
    drop_table :posts
  end
end