More cleanup

This commit is contained in:
David Robertson 2023-05-09 20:35:10 +01:00
parent d74cf83ee6
commit 1dd19b6ace
No known key found for this signature in database
GPG Key ID: 903ECE108A39DEDD

View File

@ -259,7 +259,7 @@ func cleanupDevice(txn *sqlx.Tx, device *oldDevice) (err error) {
err = exec(
txn,
`DELETE FROM syncv3_to_device_ack_pos WHERE device_id = $1`,
expectAnyNumberOfRowsAffected,
expectAtMostOneRowAffected,
device.AccessTokenHash,
)
if err != nil {
@ -269,6 +269,16 @@ func cleanupDevice(txn *sqlx.Tx, device *oldDevice) (err error) {
err = exec(
txn,
`DELETE FROM syncv3_device_data WHERE device_id = $1`,
expectAtMostOneRowAffected,
device.AccessTokenHash,
)
if err != nil {
return
}
err = exec(
txn,
`DELETE FROM syncv3_txns WHERE user_id = $1`,
expectAnyNumberOfRowsAffected,
device.AccessTokenHash,
)