Drizzle ORM patterns -- schema definition, indexes, relations, migrations, transactions, upserts, prepared statements, and connection setup
96
96%
Does it follow best practices?
Impact
98%
1.60xAverage score across 5 eval scenarios
Passed
No known issues
A content team is building a blog CMS with TypeScript, Drizzle ORM, and SQLite. The database has three entities: authors, posts, and comments. Each post belongs to one author and can have many comments. Posts have a status (draft, published, archived) and a published date. Comments are associated with both a post and an author (the commenter).
The frontend needs these data access functions:
The team also needs the drizzle-kit setup so they can manage schema changes going forward.
Produce:
src/db/schema.ts -- Full Drizzle schema for authors, posts, and commentssrc/db/queries.ts -- The four query functions exported as named functionssrc/db/db.ts -- Database connection setupdrizzle.config.ts -- drizzle-kit configurationmigration-guide.md -- Brief instructions for generating and applying migrations