Sha256: f0bc055a2caa4a01865eed2c83757bc7dc25f216ec0296a89b687c14f52a3364

Contents?: true

Size: 546 Bytes

Versions: 1

Compression:

Stored size: 546 Bytes

Contents

class AddCompletedAtToTasks < ActiveRecord::Migration
  def up
    add_column :tasks, :completed_at, :timestamp, null: true
    Task.reset_column_information
    
    Task.joins(:project)
      .where(Project.arel_table[:category].eq("Libraries"))
      .committed
      .update_all("completed_at=first_commit_at")
    
    Task.joins(:project)
      .where(Project.arel_table[:category].not_eq("Libraries"))
      .released
      .update_all("completed_at=first_release_at")
  end
  
  def down
    remove_column :tasks, :completed_at
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
houston-core-0.5.0.beta1 db/migrate/20140824194526_add_completed_at_to_tasks.rb