drizzle-orm

Create and migrate SQLite and MySQL schemas with Drizzle ORM.

11|2|Updated Feb 5, 2026
One-click install
npx skills add https://github.com/recca0120/code-quest --skill drizzle-orm-recca0120
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drizzle-orm
Source: https://github.com/recca0120/code-quest/tree/main/.claude/skills/drizzle-orm
Command: npx skills add https://github.com/recca0120/code-quest --skill drizzle-orm-recca0120

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires drizzle-orm, drizzle-zod, mysql2, better-sqlite3, drizzle-kit, and includes scripts (resource) components.

What problem does it solve?

Drizzle ORM patterns prevent schema drift and migration mistakes when you need to support multiple SQL dialects (SQLite and MySQL) in the same application.

Core Features & Use Cases

  • Multi-dialect schema organization (SQLite + MySQL): Keep equivalent table definitions and clients per dialect while sharing common column naming.
  • Consistency verification: Validate that dialect-specific tables still match the intended column sets using schema consistency tests.
  • Production-grade migration workflow: Generate and run separate migrations per dialect, plus optional database studio workflows for inspection and debugging.

Use Case: You are adding new session fields and raw-event tables to support persisted session management and event append/query in a web server that can run on SQLite locally and MySQL in production.

Quick Start

Add or update schema definitions under apps/server/src/db for the target dialect, ensure shared column names stay in sync, then run migrations for both SQLite and MySQL and verify schema consistency with the test that checks table columns.

Frequently Asked Questions about drizzle-orm

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I maintain consistent database schemas across SQLite and MySQL using Drizzle ORM?

To maintain consistent database schemas across SQLite and MySQL using Drizzle ORM, you define equivalent table definitions per dialect while sharing common column naming constants. This prevents schema drift by ensuring column alignment across different SQL dialects.

What is the best way to generate separate migrations for SQLite and MySQL in a multi-dialect setup?

The best way to generate separate migrations for SQLite and MySQL is to use dialect-scoped migration generation. This workflow allows you to create and run distinct migrations per dialect, preventing migration mistakes when supporting multiple SQL environments.

How do I verify schema consistency between different SQL dialects during database testing?

You verify schema consistency between SQL dialects by writing schema consistency tests that check table columns. These tests validate that dialect-specific tables still match the intended column sets, ensuring shared column names stay in sync across environments.

Can I use drizzle-zod with better-sqlite3 and mysql2 clients in the same application?

Yes, you can use drizzle-zod with better-sqlite3 and mysql2 clients in the same application. The setup requires dialect-specific clients for each environment, allowing you to run SQLite locally and MySQL in production while sharing schema definitions.

Why do I need shared column constants when defining tables and relations for multiple database dialects?

You need shared column constants when defining tables and relations to prevent schema drift across SQLite and MySQL. Keeping equivalent table definitions in sync ensures that dialect-specific tables match the intended column sets during multi-environment deployments.

How do I implement repository patterns with Drizzle ORM for multi-environment deployments?

To implement repository patterns with Drizzle ORM for multi-environment deployments, you define tables and relations using shared column constants and dialect-specific clients. This setup supports consistent data access whether running SQLite locally or MySQL in production.