内部依赖失败的 HTTP 状态代码

HTTP Status code for internal dependency failure

我将用一个简单的例子来描述我的问题,我有 2 tables (X & Y):

      Table X             Table Y
------------------       ----------
| id  |   Y_id   |       |   id   | 
------------------       ----------

我的 API 路由将从 table Y 中删除一行,但是如果 table X 使用该行怎么办,例如这种情况:

      Table X             Table Y
------------------       ----------
| id  |   Y_id   |       |   id   | 
------------------       ----------
|  1  |     1    |       |    1   |
------------------       ----------

如果我请求从 table Y 中删除 ID 为 1 的行,我将拒绝此请求,因为该条目正在 table X 中使用,响应 HTTP 状态应该是什么这种情况下的代码?

https://greenbytes.de/tech/webdav/rfc7231.html#status.409:

6.5.8. 409 Conflict

The 409 (Conflict) status code indicates that the request could not be completed due to a conflict with the current state of the target resource. This code is used in situations where the user might be able to resolve the conflict and resubmit the request. The server SHOULD generate a payload that includes enough information for a user to recognize the source of the conflict.

Conflicts are most likely to occur in response to a PUT request. For example, if versioning were being used and the representation being PUT included changes to a resource that conflict with those made by an earlier (third-party) request, the origin server might use a 409 response to indicate that it can't complete the request. In this case, the response representation would likely contain information useful for merging the differences based on the revision history.