gitlab-org--gitlab-foss/spec/support/services
Timothy Andrew 133f00bedd Move records to the ghost user in a transaction.
- While deleting a user, some of the user's associated records are moved to the
  ghost user so they aren't deleted. The user is blocked before these records
  are moved, to prevent the user from creating new records while the migration
  is happening, and so preventing a data race.

- Previously, if the migration failed, the user would _remain_ blocked, which is
  not the expected behavior. On the other hand, we can't just stick the block +
  migration into a transaction, because we want the block to be committed before
  the migration starts (for the data race reason mentioned above).

- One solution (implemented in this commit) is to block the user in a parent
  transaction, migrate the associated records in a nested sub-transaction, and
  then unblock the user in the parent transaction if the sub-transaction fails.
2017-04-24 06:46:10 +00:00
..
issuable_create_service_shared_examples.rb Add traits for ProjectFeatures to Project factory 2017-02-05 13:11:45 +05:00
issuable_create_service_slash_commands_shared_examples.rb Don't use FFaker in factories, use sequences instead 2017-04-03 18:54:48 +02:00
issuable_update_service_shared_examples.rb Check if user can read issue before being assigned 2016-12-27 19:25:17 -02:00
migrate_to_ghost_user_service_shared_examples.rb Move records to the ghost user in a transaction. 2017-04-24 06:46:10 +00:00