Sha256: c6cac2423b8466c3a01351a74366e706d3b25dd12d5629c5068cf2840d541cbf

Contents?: true

Size: 266 Bytes

Versions: 33

Compression:

Stored size: 266 Bytes

Contents

class DeleteOrphanStatuses < ActiveRecord::Migration[5.0]
  def up
    ids = Shipit::Status.left_joins(:commit).where(commits: {id: nil}).pluck(:id)
    say "Found #{ids.size} orphan statuses"
    Shipit::Status.where(id: ids).delete_all
  end

  def down
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
shipit-engine-0.24.0 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.23.1 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.23.0 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.22.0 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.21.0 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.20.1 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.20.0 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.19.0 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.18.1 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.18.0 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.17.0 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.16.0 db/migrate/20161206104100_delete_orphan_statuses.rb
shipit-engine-0.15.0 db/migrate/20161206104100_delete_orphan_statuses.rb