Skip to content

Add Settings to delete unconfirmed users

Jessie Young requested to merge jy-delayed-user-deletion into master

What does this MR do and why?

  • Start of work on #352514 (closed)
  • There is prior art for this:
  • We will use this setting, if set, to kick off a cron job to delete any unconfirmed who were created over N days ago.

Migration output

Migrate

% bin/rails db:migrate:main RAILS_ENV=development
main: == [advisory_lock_connection] object_id: 279100, pg_backend_pid: 49647
main: == 20230601035558 AddUnconfirmedUserDeletionToApplicationSettings: migrating ==
main: -- add_column(:application_settings, :delete_unconfirmed_users, :boolean, {:default=>false, :null=>false})
main:    -> 0.0071s
main: -- add_column(:application_settings, :unconfirmed_users_delete_after_days, :integer, {:default=>7, :null=>false})
main:    -> 0.0030s
main: == 20230601035558 AddUnconfirmedUserDeletionToApplicationSettings: migrated (0.0245s)

main: == [advisory_lock_connection] object_id: 279100, pg_backend_pid: 49647

Rollback

bin/rails db:rollback:main VERSION=20230601035558 RAILS_ENV=development
main: == [advisory_lock_connection] object_id: 278900, pg_backend_pid: 49197
main: == 20230601035558 AddUnconfirmedUserDeletionToApplicationSettings: reverting ==
main: -- remove_column(:application_settings, :unconfirmed_users_delete_after_days, :integer, {:default=>7, :null=>false})
main:    -> 0.0034s
main: -- remove_column(:application_settings, :delete_unconfirmed_users, :boolean, {:default=>false, :null=>false})
main:    -> 0.0013s
main: == 20230601035558 AddUnconfirmedUserDeletionToApplicationSettings: reverted (0.0127s)

main: == [advisory_lock_connection] object_id: 278900, pg_backend_pid: 49197

How to set up and validate locally

There is nothing to use here yet, the cron job for deleting users when this setting is set and the UI will be added in separate MRs.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Jessie Young

Merge request reports

Loading