How to get good at Drizzle?
Hello I am currently having a huge problem with Drizzle, and relational databases in general.
I start writing my schema, but after finishing a few tables (5-10) I get overwhelmed by the amount of objects and relations happening between them and don't know what to do, and how to properly connect them together.
At this point I just delete my entire schema and start writing it from scratch, in hopes of implementing it correctly this time. This process repeats a few times and I never actually finish the database.
I am also very confused when thinking about the later part of the application, where I would have to insert the data, as nested objects would have to be inserted in multiple layers which sounds so complicated at scale.
Example having a
The example above would be even messier in code, while I am thinking of inserting something more elegant like this:
Do you have any tips on staying organised and not getting overwhelmed when writing Drizzle schemas?
I start writing my schema, but after finishing a few tables (5-10) I get overwhelmed by the amount of objects and relations happening between them and don't know what to do, and how to properly connect them together.
At this point I just delete my entire schema and start writing it from scratch, in hopes of implementing it correctly this time. This process repeats a few times and I never actually finish the database.
I am also very confused when thinking about the later part of the application, where I would have to insert the data, as nested objects would have to be inserted in multiple layers which sounds so complicated at scale.
Example having a
product with variants of that product which have prices. I would have to create a price, then assign the price_id to a variant, then do the same for a product. The logic seems backwards, so instead of thinking about inserting a product I first have to insert a price then variant then product. And all that at just 3 levels of nesting.The example above would be even messier in code, while I am thinking of inserting something more elegant like this:
Do you have any tips on staying organised and not getting overwhelmed when writing Drizzle schemas?