drizzle

Define TypeScript database schemas and generate migrations with Drizzle ORM.

81.4k|15.8k|Updated May 21, 2023
One-click install
npx skills add https://github.com/lobehub/lobehub --skill drizzle-lobehub
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: drizzle
Source: https://github.com/lobehub/lobehub/tree/main/.agents/skills/drizzle
Command: npx skills add https://github.com/lobehub/lobehub --skill drizzle-lobehub

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Drizzle ORM provides a strongly-typed way to define database schemas, migrations, and ORM models in TypeScript, reducing boilerplate and helping prevent schema drift.

Core Features & Use Cases

  • Schema Definition: Define tables and columns in a type-safe, declarative style.
  • Migrations: Manage migrations with predictable, versioned changes.
  • Type-Safe Queries: Generate SQL with full TypeScript support for safer data access.
  • Use Case: When starting a new PostgreSQL-backed project, model tables under src/database/schemas and generate migrations from those definitions.

Quick Start

Install Drizzle ORM in your project, create your first schema under src/database/schemas, and run the migration workflow to apply changes to your database.

Frequently Asked Questions about drizzle

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

FAQPage Schema
How do I define database schemas with type safety in TypeScript?

To define database schemas with type safety in TypeScript, use Drizzle ORM to declaratively model tables and columns under a src/database/schemas directory. This prevents schema drift and reduces boilerplate by enforcing types directly in your TypeScript project.

What is the best way to manage migrations in a TypeScript PostgreSQL project?

Managing migrations in a TypeScript PostgreSQL project is best handled by defining declarative schema models with Drizzle ORM. You can generate predictable, versioned migration files from these definitions and run the workflow to apply changes to your database.

How do type-safe queries prevent schema drift in TypeScript ORM models?

Type-safe queries prevent schema drift by generating SQL with full TypeScript support, ensuring data access matches your schema definitions. Drizzle ORM uses these strongly-typed models to reduce boilerplate and validate queries against the database structure at compile time.

Does Drizzle ORM work with PostgreSQL and other databases?

Yes, Drizzle ORM works with PostgreSQL and other supported databases to model schemas and execute type-safe queries. It requires a TypeScript project setup with Drizzle installed and a designated schemas directory to manage your database definitions.

How do I start modeling tables for a new PostgreSQL-backed project?

To start modeling tables for a new PostgreSQL-backed project, install Drizzle ORM in your TypeScript environment. Create your first schema definition under src/database/schemas, then run the migration workflow to apply the versioned changes to your database.