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