about summary refs log tree commit diff
path: root/db/post_migrate
diff options
context:
space:
mode:
Diffstat (limited to 'db/post_migrate')
-rw-r--r--db/post_migrate/20220429101025_remove_ips_from_email_domain_blocks.rb12
-rw-r--r--db/post_migrate/20220429101850_clear_email_domain_blocks.rb14
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