From Discord: Incompatibility of `SqlMessageStorage` with Vitess Databases Due to Foreign Key Constraints
Summary
The SqlMessageStorage implementation currently uses a recursive foreign key constraint (messages.requestId -> messages.id) with ON DELETE CASCADE, which is incompatible with Vitess databases like Planetscale due to their restrictions on foreign keys. The conversation highlights Vitess' specific rules against such foreign keys (https://vitess.io/docs/22.0/user-guides/vschema-guide/foreign-keys/). This issue does not seem to affect standard Postgres databases on Planetscale. A potential solution discussed is to remove the ON DELETE CASCADE requirement by introducing a closure table to manage parent-child relationships between messages, enabling controlled cascading deletions without violating Vitess constraints. The user is willing to assist in developing this solution.
Discord thread
https://discord.com/channels/795981131316985866/1425409435718652055
Cluster in v4 doesn't use foreign keys anymore, this issue can be closed