Todo (MySQL with Drizzle)
This page documents the Todo schema for projects using MySQL with Drizzle ORM.
The MySQL implementation focuses on compatibility and performance, using standard types and efficient indexes.
Installation Guide
To add this schema to your project, run:
npx servercn-cli add schema todoDuring initialization, ensure you select MySQL when prompted for the database.
Database Design
To see the complete database design, including the User schema from the Auth Domain, please click here visualization.
If you install schema individually, the relationships between them won't be automatic—you'll need to implement them manually.
1. User Schema
The User Schema is the core component for storing user identity, credentials, and profile information.
File Path: src/drizzle/schemas/user.schema.ts
2. Todo Schema
The Todo Schema defines the structure of your tasks in MySQL.
File Path: src/drizzle/schemas/todo.schema.ts
Installation:
npx servercn-cli add schema todo/todo3. schema.helper.ts
src/drizzle/schemas/schema.helper.ts
4. Export all schemas
ssrc/drizzle/index.ts
5. drizzle.config.ts
drizzle.config.ts
Relational Design
Explicit relations make data fetching much simpler and more expressive:
src/drizzle/schemas/user.schema.ts
src/drizzle/schemas/todo.schema.ts
If you install schema individually, the relationships between them won't be automatic—you'll need to implement them manually.