diff --git a/db/migrate/20220725070026_cleanup_assign_tos_from_betagouv.rb b/db/migrate/20220725070026_cleanup_assign_tos_from_betagouv.rb new file mode 100644 index 000000000..e58878c33 --- /dev/null +++ b/db/migrate/20220725070026_cleanup_assign_tos_from_betagouv.rb @@ -0,0 +1,12 @@ +class CleanupAssignTosFromBetagouv < ActiveRecord::Migration[6.1] + def up + super_admin_emails = SuperAdmin.all.pluck(:email) + + super_admin_emails.each do |email| + user = User.find_by(email: email) + if user && user.instructeur + user.instructeur.assign_to.destroy_all + end + end + end +end