diff --git a/db/migrate/20210713092503_set_users_flair_group_id.rb b/db/migrate/20210713092503_set_users_flair_group_id.rb
new file mode 100644
index 00000000000..fdcd573a902
--- /dev/null
+++ b/db/migrate/20210713092503_set_users_flair_group_id.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class SetUsersFlairGroupId < ActiveRecord::Migration[6.1]
+  def change
+    execute <<~SQL
+      UPDATE users
+      SET flair_group_id = primary_group_id
+      WHERE flair_group_id IS NULL
+    SQL
+  end
+end