fix: Don't crash if foreign key constraint is invalid in transaction (#1004)

ForeignKey constraints can be invalidated in the middle of a transaction
even if a later statement in the same transaction will make them valid
again. This seems to be causing production crashes.

Defer foreign key constraint checks until the end of the transaction to
prevent this.
This commit is contained in:
Nik Clayton 2024-10-14 18:42:55 +02:00 committed by GitHub
parent fd9cc2ea96
commit eeca401942
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 0 deletions

View File

@ -55,6 +55,7 @@ import java.util.Date
entity = TimelineAccountEntity::class, entity = TimelineAccountEntity::class,
parentColumns = ["serverId", "timelineUserId"], parentColumns = ["serverId", "timelineUserId"],
childColumns = ["authorServerId", "timelineUserId"], childColumns = ["authorServerId", "timelineUserId"],
deferred = true,
), ),
] ]
), ),