Sha256: e90b891ab6b4ceb28c0ae89b87d652f85698267897080c2e2fabb24dfabec7ef

Contents?: true

Size: 369 Bytes

Versions: 33

Compression:

Stored size: 369 Bytes

Contents

class BackfillStackIdOnStatuses < ActiveRecord::Migration[5.0]
  def up
    Shipit::Commit.order(stack_id: :asc).find_in_batches do |commits|
      commits.group_by(&:stack_id).each do |stack_id, stack_commits|
        Shipit::Status.where(commit_id: stack_commits.map(&:id)).update_all(stack_id: stack_id)
      end
      print '.'
    end
  end

  def down
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
shipit-engine-0.39.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.38.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.37.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.36.1 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.36.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.35.1 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.35.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.34.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.33.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.32.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.31.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.30.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.29.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.28.1 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.28.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.27.1 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.27.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.26.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.25.1 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb
shipit-engine-0.25.0 db/migrate/20161206104817_backfill_stack_id_on_statuses.rb