mirror of
https://github.com/juanfont/headscale.git
synced 2026-10-04 13:53:37 +09:00
db: delete pre-auth key on its own savepoint
This commit is contained in:
@@ -341,8 +341,9 @@ func DestroyPreAuthKey(tx *gorm.DB, id uint64) error {
|
|||||||
return fmt.Errorf("clearing auth_key_id on nodes: %w", err)
|
return fmt.Errorf("clearing auth_key_id on nodes: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Then delete the pre-auth key
|
// Then delete the pre-auth key, on the same savepoint as the
|
||||||
res := tx.Unscoped().Delete(&types.PreAuthKey{}, id)
|
// node update so both roll back together.
|
||||||
|
res := db.Unscoped().Delete(&types.PreAuthKey{}, id)
|
||||||
if res.Error != nil {
|
if res.Error != nil {
|
||||||
return res.Error
|
return res.Error
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user