| name | tidbx-prisma |
| description | Prisma ORM setup and usage for TiDB from Node.js/TypeScript. Covers configuring prisma/schema.prisma (MySQL provider), DATABASE_URL formatting for TiDB Cloud TLS (sslaccept=strict and optional sslcert), migrations (prisma migrate), Prisma Client generation, CRUD patterns, and safe raw SQL ($queryRaw) plus runnable templates. |
TiDB Prisma Integration
Comprehensive Prisma ORM setup for TiDB with guided workflows.
When to use this skill
- Set up Prisma in a new Node.js/TypeScript project
- Add Prisma to an existing project
- Define/modify models and run migrations
- Configure TiDB Cloud TLS correctly via
DATABASE_URL
- Troubleshoot Prisma connection or migration issues
Prisma vs drivers
Prisma is an ORM (models + migrations + typed client). If you only need a low-level MySQL driver, use:
tidbx-javascript-mysql2 (promise-native)
tidbx-javascript-mysqljs (callback-based)
Available guides
guides/quickstart.md -- new project: install -> init -> migrate -> run TS quickstart
guides/troubleshooting.md -- common TLS/connection/client-generation issues
I'll pick the smallest guide that matches your request, then use templates/scripts as needed.
Quick examples
- "Add Prisma to my existing Node API and connect to TiDB Cloud" -> follow quickstart, then integrate client
- "My TiDB Cloud public endpoint fails with TLS errors" -> fix
DATABASE_URL TLS params
- "Create tables from my Prisma models" -> run
prisma migrate dev
Reference: datasource config
In prisma/schema.prisma, use the MySQL connector and read :