Skip to content
Snippets Groups Projects
Commit f5febf60 authored by Z.J. van de Weg's avatar Z.J. van de Weg
Browse files

Requeue all soft deleted namespaces and projects

The first take on this problem involved a worker requeueing 256 of these
per 4 hours. Than it was suggested that this might not be needed, and
post deployment migrations could be used.

Given we monitor the number of projects which are pending deletion, we
could give this strategy a try and take a look about a few hours later
to see how this fares.
parent 1266532f
No related branches found
No related tags found
No related merge requests found
class RequeuePendingDelete < ActiveRecord::Migration
include Gitlab::Database::MigrationHelpers
DOWNTIME = false
# When using the methods "add_concurrent_index" or "add_column_with_default"
# you must disable the use of transactions as these methods can not run in an
# existing transaction. When using "add_concurrent_index" make sure that this
# method is the _only_ method called in the migration, any other changes
# should go in a separate migration. This ensures that upon failure _only_ the
# index creation fails and can be retried or reverted easily.
#
# To disable transactions uncomment the following line and remove these
# comments:
# disable_ddl_transaction!
def up
admin = User.find_by(admin: true)
Group.with_deleted.where.not(deleted_at: nil).find_each do |group|
GroupDestroyWorker.perform_async(group.id, admin.id)
end
Project.unscoped.where(pending_delete: true).find_each do |project|
ProjectDestroyWorker.perform_async(project.id, admin.id)
end
end
def down
# Noop
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment