Avoid range locks while deleting synced entries
Avoid range locks while deleting synced entries

The following deadlock was logged (truncated for clarity) and appears to be a conflict between an commit entry insertion while another thread is deleting records as part of a `Stagehand::Staging::Synchronizer#sync` call. The solution seems to be similar to other lock-related modifications we’ve made to Stagehand where writes without specifically targeting rows by their primary key is liable to trigger a deadlock because locks are acquired for every row encountered by the query, regardless of whether that row matches the query conditions.

Instead of performing a delete across a range of records, a list of the matching record ids is plucked, and then deletes are performed on the `CommitEntry` rows that match those ids. According to the MySQL documentation this will only lock the rows being deleted, thereby allowing other threads to insert `CommitEntry` rows without waiting for a lock held by the delete.

------------------------
LATEST DETECTED DEADLOCK
------------------------
2022-06-23 09:06:10 0xc2d4
*** (1) TRANSACTION:
TRANSACTION 124528332, ACTIVE 22 sec inserting
mysql tables in use 1, locked 1
LOCK WAIT 3 lock struct(s), heap size 1136, 2 row lock(s), undo log entries 2
MySQL thread id 12902, OS thread handle 49872, query id 104301455 172.16.129.4 dbadmin
INSERT INTO `stagehand_commit_entries` (`operation`, `session`, `created_at`) VALUES ('commit_end', '12902', '2022-06-23 09:05:50')
*** (1) WAITING FOR THIS LOCK TO BE GRANTED:
RECORD LOCKS space id 10695 page no 12 n bits 872 index index_stagehand_commit_entries_on_record_id_and_table_name of table `sparkle_atrium_staging`.`stagehand_commit_entries` trx id 124528332 lock_mode X locks gap before rec insert intention waiting
Record lock, heap no 764 PHYSICAL RECORD: n_fields 3; compact format; info bits 32
 0: len 4; hex 80000001; asc     ;;
 1: len 10; hex 70687973696369616e73; asc physicians;;
 2: len 4; hex 81237441; asc  #tA;;

*** (2) TRANSACTION:
TRANSACTION 124528312, ACTIVE 33 sec fetching rows
mysql tables in use 1, locked 1
392 lock struct(s), heap size 41168, 1730 row lock(s), undo log entries 1993
MySQL thread id 12829, OS thread handle 49876, query id 104311195 172.16.129.4 dbadmin updating
DELETE FROM `stagehand_commit_entries` WHERE ((table_name = 'physicians' AND record_id IN (1998))) AND (id <= 19100336) AND `stagehand_commit_entries`.`id` != 1459965
*** (2) HOLDS THE LOCK(S):
RECORD LOCKS space id 10695 page no 12 n bits 872 index index_stagehand_commit_entries_on_record_id_and_table_name of table `sparkle_atrium_staging`.`stagehand_commit_entries` trx id 124528312 lock_mode X
Record lock, heap no 1 PHYSICAL RECORD: n_fields 1; compact format; info bits 0
 0: len 8; hex 73757072656d756d; asc supremum;;

culturecode/stagehand