Sha256: f7ea39c70afc0b7f592e7e2e7d93d95ade5d40f294a4b36842bcaa0a9fe500e3

Contents?: true

Size: 480 Bytes

Versions: 1

Compression:

Stored size: 480 Bytes

Contents

class AddSelectorFieldsToFinishes < ActiveRecord::Migration
  def up
    Finish.all.each do |finish|
      finish.selected = false
      finish.save!
    end

    add_column :finishes, :selected_by_id, :integer
    add_foreign_key :finishes, :users, column: :selected_by_id
    add_column :finishes, :selected_at, :datetime
    add_index :finishes, :selected_by_id
  end

  def down
    remove_column :finishes, :selected_by_id
    remove_column :finishes, :selected_at
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
self_systeem-0.1.0 test/dummy_app/db/migrate/20140408220118_add_selector_fields_to_finishes.rb