How does drizzle-kit push:sqlite
order its SQL statements?
#1139
Unanswered
michaeldebetaz
asked this question in
Q&A
Replies: 1 comment 6 replies
-
what do you mean by both ways? |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
EDIT : Since I asked this question, I had the opportunity to work a lot with drizzle ☀ I think the problems I encountered came from a misconception I had about the
references
properties. I made them go both ways (each one had a foreign key constrain that pointed to the other), which should never be the case. Maybedrizzle-kit check
could validate the schema against looping references.I hope this would help other people wondering the same things!
I'm currently developping an app using
better-sqlite
anddrizzle
. I am happy to abusedrizzle-kit push:sqlite
for quick development. However, I encountered some obstacles as my database schema became more complex.As I understand it,
push
sequentially:My database has tables with foreign keys and some of them have the
on delete restrict
constrain. In some cases, I noticed that the SQL executed during apush
altered the foreign table before the tables with the constrained foreign key, which errored the whole operation.I changed the fields to
on delete cascade
for the time being, but I would like to know how thedrizzle-kit push
decides the order in which the tables are altered. I tried to change the order of the tables in my schemas but with no success.I'm loving dirzzle so far! Thank you so much for making such a cool ORM 🔥
Beta Was this translation helpful? Give feedback.
All reactions