Terminal
Terminal/Skill
Sets up Prisma ORM with TiDB Cloud from Node.js and TypeScript, including TLS connection strings, migrations and safe raw SQL.
By PingCAP (TiDB)
Works with
npx skills add pingcap/agent-rules --skill tidbx-prismaComprehensive Prisma ORM setup for TiDB with guided workflows.
DATABASE_URLPrisma 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)guides/quickstart.md -- new project: install -> init -> migrate -> run TS quickstartguides/troubleshooting.md -- common TLS/connection/client-generation issuesI'll pick the smallest guide that matches your request, then use templates/scripts as needed.
DATABASE_URL TLS paramsprisma migrate devIn prisma/schema.prisma, use the MySQL connector and read DATABASE_URL:
generator client {
provider = "prisma-client-js"
}
datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}
For TiDB Cloud public endpoints, configure TLS via query params in DATABASE_URL:
?sslaccept=strict?sslaccept=strict&sslcert=/absolute/path/to/ca.pemExamples:
DATABASE_URL='mysql://USER:PASSWORD@HOST:4000/DATABASE?sslaccept=strict'
DATABASE_URL='mysql://USER:PASSWORD@HOST:4000/DATABASE?sslaccept=strict&sslcert=/absolute/path/to/ca.pem'
npm i @prisma/client
npm i -D prisma typescript ts-node @types/node
import { PrismaClient } from '@prisma/client'
const prisma = new PrismaClient()
try {
// ... queries ...
} finally {
await prisma.$disconnect()
}
$queryRaw with template literals (parameterized).$queryRawUnsafe unless you fully control the SQL.const rows = await prisma.$queryRaw`SELECT VERSION() AS version`
templates/schema.prisma -- example schema (Player/Profile) mapped to TiDB tablestemplates/quickstart.ts -- minimal Prisma app: connect -> version -> CRUD (run with ts-node)scripts/validate_connection.ts -- connects and prints SELECT VERSION() (run with ts-node)tidbx-nextjs -- Next.js App Router integration patterns (route handlers, runtimes, deployment)tidbx-kysely -- typed query builder alternative to Prismatidbx-javascript-mysql2 -- low-level driver (promise API)tidbx-javascript-mysqljs -- low-level driver (callback API)I will:
guides/quickstart.md or guides/troubleshooting.md)