You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thank you so so much for the library, it is amazing! 🚀
I just have one 'issue' that happens when dealing with two tables that depend on each other (using the Supabase plugin). Let's say you have exams and chapters. An exam can have multiple chapters, and upon exam creation, I ask the user how many chapters they want to add for that exam. When the number of chapters is submitted, the exam is created, and just after that, the chapters containing the FK to that exam are created.
The problem is that when I do this, I get errors when saving, since at the point of adding the chapter, it seems like the exam is still being created. I am solving it by having infinite retries, which fixes the issue, but it would be nice for LegendState to handle this in a better way by waiting for one insert to be completed before starting the next one.
[Error: insert or update on table "chapters" violates foreign key constraint "fk_exam"]
It seems like the batch operation does not ensure the order of execution when writing to the database, causing FK constraints to fail. Would it be possible to implement a way for LegendState to ensure that the exam insert completes before inserting dependent chapters?
Thank you again, this library rocks!
The text was updated successfully, but these errors were encountered:
Hello, thank you so so much for the library, it is amazing! 🚀
I just have one 'issue' that happens when dealing with two tables that depend on each other (using the Supabase plugin). Let's say you have
exams
andchapters
. An exam can have multiple chapters, and upon exam creation, I ask the user how many chapters they want to add for that exam. When the number of chapters is submitted, the exam is created, and just after that, the chapters containing the FK to that exam are created.The problem is that when I do this, I get errors when saving, since at the point of adding the chapter, it seems like the exam is still being created. I am solving it by having infinite retries, which fixes the issue, but it would be nice for LegendState to handle this in a better way by waiting for one insert to be completed before starting the next one.
Here is the saving code:
Error received:
It seems like the batch operation does not ensure the order of execution when writing to the database, causing FK constraints to fail. Would it be possible to implement a way for LegendState to ensure that the exam insert completes before inserting dependent chapters?
Thank you again, this library rocks!
The text was updated successfully, but these errors were encountered: