Drizzle ORM is a TypeScript-first ORM that treats SQL as a first-class citizen. Its drizzle-kit tool generates migration files from schema diffs, while the relations() helper enables a relational query API separate from the database schema definition.
0 / 5 completed
1 / 5
A developer runs drizzle-kit generate after modifying a Drizzle schema file. What does this command produce?
drizzle-kit generate compares the current schema definition with the previously tracked state and generates SQL migration files in the configured migrations folder. These files are not applied automatically — you must run drizzle-kit migrate separately.
2 / 5
What is the purpose of the drizzle-kit push command, and when should it be avoided?
drizzle-kit push applies schema changes directly to the database without generating SQL migration files. It is useful for rapid prototyping and development but should be avoided in production since changes are not tracked in version-controlled migration files.
3 / 5
In Drizzle ORM, how do you define a foreign key relationship between two tables?
In Drizzle ORM, foreign keys are defined inline using references(): authorId: integer('author_id').references(() => users.id). The lambda syntax avoids circular reference issues. You can also specify onDelete and onUpdate actions.
4 / 5
A Drizzle ORM query uses db.select().from(users).where(eq(users.role, 'admin')). What does the eq function do?
eq() is one of Drizzle ORM's SQL operator helpers that generates a typed column = value WHERE condition. Drizzle provides a full set of operators: eq, ne, lt, gt, like, inArray, etc., all producing type-safe SQL.
5 / 5
Which Drizzle ORM feature allows defining relations for use with db.query API but does NOT affect the database schema?
The relations() helper defines logical relationships between tables for Drizzle's relational query API (db.query) without adding foreign key constraints to the database. This allows eager loading with with: clauses while keeping the schema unchanged.