Sha256: 54e8f4289ac3017ab4d7785b2df3229068ddff1d6a2dc0764b25b0e7a03e6c9c

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

class CreateArticles < ActiveRecord::Migration
  def self.up
    create_table :articles do |t|
      t.string :title
      t.string :body
      t.boolean :read
    end
    add_index :articles, :title
    
    Article.create_movable_table(:archived)
    add_column :archived_articles, :move_id, :string
    add_column :archived_articles, :moved_at, :datetime
    
    Article.create_movable_table(:drafted)
    
    create_table :comments do |t|
      t.string :title
      t.string :body
      t.boolean :read
      t.integer :article_id
    end
    
    Comment.create_movable_table(:archived)
    add_column :archived_comments, :move_id, :string
    add_column :archived_comments, :moved_at, :datetime
  end

  def self.down
    drop_table :articles
    drop_table :comments
    Article.drop_movable_table(:archived)
    Comment.drop_movable_table(:archived)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mover-0.1.0 spec/db/migrate/001_create_articles.rb