Skip to content

Delete namespace_deletion_schedule when restoring project marked for deletion.

What does this MR do and why?

Destroy the project's deletion schedule when setting marked_for_deletion_at column to NULL. This is the next step towards moving deletion schedule related column off the projects table

DELETE Query Plan: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/40046/commands/123244

References

Closes #540603 (closed)

Screenshots or screen recordings

N/A

How to set up and validate locally

  1. Enable the replicate_deletion_schedule_operations feature flag Feature.enable(:replicate_deletion_schedule_operations)
  2. Open a project and go to Settings > General > Advanced > Delete Project to marked the project for deletion.
  3. In the rails console, run the following command to add a deletion schedule:
Project.find_by_path(...).project_namespace.deletion_schedule = Namespaces::DeletionSchedule.create!(marked_for_deletion_at: Time.current, deleting_user: User.first)
  1. Go back to Settings > General > Advanced > Restore Project and restore the project.
  2. Run the following command to verify that the restoration is successful:
Project.find_by_path(...).project_namespace.deletion_schedule
=> nil

Project.find_by_path(...).marked_for_deletion_at
=> nil

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Shane Maglangit

Merge request reports

Loading