diff options
Diffstat (limited to 'db/post_migrate/20210420103955_remove_hipchat_service_records.rb')
-rw-r--r-- | db/post_migrate/20210420103955_remove_hipchat_service_records.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/db/post_migrate/20210420103955_remove_hipchat_service_records.rb b/db/post_migrate/20210420103955_remove_hipchat_service_records.rb new file mode 100644 index 00000000000..5ad34cfad22 --- /dev/null +++ b/db/post_migrate/20210420103955_remove_hipchat_service_records.rb @@ -0,0 +1,21 @@ +# frozen_string_literal: true + +class RemoveHipchatServiceRecords < ActiveRecord::Migration[6.0] + disable_ddl_transaction! + + class Service < ActiveRecord::Base + include EachBatch + + self.table_name = 'services' + end + + def up + Service.each_batch(of: 100_000, column: :id) do |relation| + relation.delete_by(type: 'HipchatService') + end + end + + def down + # no-op + end +end |