diff options
author | Eugen Rochko <eugen@zeonfederated.com> | 2022-04-29 23:27:03 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 23:27:03 +0200 |
commit | f6d35ed57d156f4225338a89372c8e83721e46c9 (patch) | |
tree | b83ee4170d73e04438158e4fd05f1b4b344b3c7e /db/post_migrate | |
parent | 7b0fe4aef97c6a5f73a03146b669a415f396799c (diff) |
Remove IP matching from e-mail domain blocks (#18190)
Clear out e-mail domain blocks created from automatically resolved DNS records
Diffstat (limited to 'db/post_migrate')
-rw-r--r-- | db/post_migrate/20220429101025_remove_ips_from_email_domain_blocks.rb | 12 | ||||
-rw-r--r-- | db/post_migrate/20220429101850_clear_email_domain_blocks.rb | 14 |
2 files changed, 26 insertions, 0 deletions
diff --git a/db/post_migrate/20220429101025_remove_ips_from_email_domain_blocks.rb b/db/post_migrate/20220429101025_remove_ips_from_email_domain_blocks.rb new file mode 100644 index 000000000..fbb74d99e --- /dev/null +++ b/db/post_migrate/20220429101025_remove_ips_from_email_domain_blocks.rb @@ -0,0 +1,12 @@ +# frozen_string_literal: true + +class RemoveIpsFromEmailDomainBlocks < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + def change + safety_assured do + remove_column :email_domain_blocks, :ips, :inet, array: true + remove_column :email_domain_blocks, :last_refresh_at, :datetime + end + end +end diff --git a/db/post_migrate/20220429101850_clear_email_domain_blocks.rb b/db/post_migrate/20220429101850_clear_email_domain_blocks.rb new file mode 100644 index 000000000..ff525b650 --- /dev/null +++ b/db/post_migrate/20220429101850_clear_email_domain_blocks.rb @@ -0,0 +1,14 @@ +# frozen_string_literal: true + +class ClearEmailDomainBlocks < ActiveRecord::Migration[5.2] + disable_ddl_transaction! + + class EmailDomainBlock < ApplicationRecord + end + + def up + EmailDomainBlock.where.not(parent_id: nil).in_batches.delete_all + end + + def down; end +end |