class CreateVersions < ActiveRecord::Migration def self.up create_table :versions do |t| t.string :versionable_type, null: false t.integer :versionable_id, null: false t.integer :user_id t.text :notes t.boolean :initial, null: false, default: false t.boolean :marked_for_removal, null: false, default: false t.boolean :accepted, null: false, default: false t.boolean :declined, null: false, default: false t.boolean :pending, null: false, default: true t.datetime :created_at end add_index :versions, :initial add_index :versions, :accepted add_index :versions, :declined add_index :versions, :pending add_index :versions, [:versionable_type, :versionable_id] end def self.down remove_index :versions, :initial remove_index :versions, :accepted remove_index :versions, :declined remove_index :versions, :pending remove_index :versions, [:verstionable_type, :versionable_id] drop_table :versions end end