Using Drizzle ORM to Design and Implement a Complex Database Structure | Common Patterns

In this video CJ shows how he used drizzle to implement a complex DB structure to represent a food delivery service called bytedash. He shows how to setup the project, how to create schemas, how to seed the DB with related data and how to query the DB with deeply nested relationships.

View the DB diagram here: https://dbdocs.io/w3cj/bytedash?schema=public&view=relationships

View the code here: https://github.com/w3cj/bytedash

Read the drizzle docs: https://orm.drizzle.team/

Listen to Wes and Scott talk about how they use Drizzle in their apps: https://syntax.fm/show/721/you-should-learn-drizzle-the-typescript-sql-orm


00:00 Intro
03:30 Drizzle: A Different Kind of ORM
04:37 Codebase Intro / Setup
07:51 Database Structure High Level Overview
09:20 Drizzle Studio Setup
12:06 Creating the Schema with Drizzle
14:10 Drizzle Foreign Key Constraints
14:45 Drizzle Composite Key Constraints
15:19 Drizzle Index Constraints
16:38 Drizzle Migration Setup
23:18 Seeding the Database with Drizzle
32:38 Querying the Database with Drizzle
34:45 Related Queries with Drizzle
35:39 Creating Table Relations
37:18 Drizzle Generated SQL Queries
38:51 Drizzle Join Query
40:34 Nested Where Queries with Drizzle
44:00 Final Thoughts on Drizzle

Play / pause the audio
Minimize / expand the player
Mute / unmute the audio
Seek backward 30 seconds
Seek forward 30 seconds
Increase playback rate
Decrease playback rate
Show / hide this window