diff options
Diffstat (limited to 'db/post_migrate/20210722042939_update_issuable_slas_where_issue_closed.rb')
-rw-r--r-- | db/post_migrate/20210722042939_update_issuable_slas_where_issue_closed.rb | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/db/post_migrate/20210722042939_update_issuable_slas_where_issue_closed.rb b/db/post_migrate/20210722042939_update_issuable_slas_where_issue_closed.rb deleted file mode 100644 index b611b51e3ff..00000000000 --- a/db/post_migrate/20210722042939_update_issuable_slas_where_issue_closed.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class UpdateIssuableSlasWhereIssueClosed < ActiveRecord::Migration[6.1] - ISSUE_CLOSED_STATUS = 2 - - class IssuableSla < ActiveRecord::Base - include EachBatch - - self.table_name = 'issuable_slas' - - belongs_to :issue, class_name: 'Issue' - end - - class Issue < ActiveRecord::Base - self.table_name = 'issues' - - has_one :issuable_sla, class_name: 'IssuableSla' - end - - def up - IssuableSla.each_batch(of: 50) do |relation| - relation.joins(:issue) - .where(issues: { state_id: ISSUE_CLOSED_STATUS } ) - .update_all(issuable_closed: true) - end - end - - def down - # no-op - end -end |