about summary refs log tree commit diff
path: root/db/migrate/20200731135033_backfill_account_metadata.rb
diff options
context:
space:
mode:
Diffstat (limited to 'db/migrate/20200731135033_backfill_account_metadata.rb')
-rw-r--r--db/migrate/20200731135033_backfill_account_metadata.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/db/migrate/20200731135033_backfill_account_metadata.rb b/db/migrate/20200731135033_backfill_account_metadata.rb
new file mode 100644
index 000000000..2ddfa6081
--- /dev/null
+++ b/db/migrate/20200731135033_backfill_account_metadata.rb
@@ -0,0 +1,11 @@
+class BackfillAccountMetadata < ActiveRecord::Migration[5.2]
+  def up
+    safety_assured do
+      execute("INSERT INTO account_metadata (account_id) SELECT id FROM accounts WHERE domain IS NULL OR domain = ''")
+    end
+  end
+
+  def down
+    true
+  end
+end