Sha256: 9c12962b505ee2778819a1ddd22697c58a7256669b6398827edf162a015e6d78

Contents?: true

Size: 477 Bytes

Versions: 17

Compression:

Stored size: 477 Bytes

Contents

class CreateSprintsTasks < ActiveRecord::Migration
  def up
    create_join_table :sprints, :tasks do |t|
      t.index [:sprint_id, :task_id], unique: true
    end

    Task.where(Task.arel_table[:sprint_id].not_eq(nil)).pluck(:id, :sprint_id).each do |task_id, sprint_id|
      SprintTask.create(task_id: task_id, sprint_id: sprint_id)
    end

    puts "\e[34m#{SprintTask.count} tasks put into sprints\e[0m"
  end

  def down
    drop_join_table :sprints, :tasks
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
houston-core-0.8.0.pre db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.7.0 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.7.0.beta4 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.7.0.beta3 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.7.0.beta2 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.7.0.beta db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.6.3 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.6.2 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.6.1 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.6.0 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.5.6 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.5.5 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.5.4 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.5.3 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.5.2 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.5.1 db/migrate/20140724231918_create_sprints_tasks.rb
houston-core-0.5.0 db/migrate/20140724231918_create_sprints_tasks.rb