Drizzle Adapter
The Drizzle adapter integrates c15t Backend with Drizzle ORM, a lightweight, type-safe SQL query builder with schema declaration.
Installation
Install Drizzle ORM and the appropriate database driver:
Configuration
- Define your schema using Drizzle's schema builder:
- Configure the c15t instance with the Drizzle adapter:
MySQL Configuration
SQLite Configuration
Usage Examples
Basic CRUD Operations
Transactions
Migrations
Use Drizzle Kit for schema migrations:
Type Safety
The Drizzle adapter provides excellent type safety:
Best Practices
- Define schema using Drizzle's builders - Leverage type safety and schema validation
- Use prepared statements - Drizzle uses prepared statements for all queries
- Implement connection pooling - Configure appropriate pool sizes for production
- Use migrations for schema changes - Manage schema changes with Drizzle Kit
Limitations
- Some complex queries may require direct Drizzle client usage
- Table names must match schema definitions