Prerequisites
- Xata account with a project and branch
- Node.js project with TypeScript
Installation
Install Drizzle ORM and the PostgreSQL driver:- Standard (TCP)
- Serverless (HTTP/WebSocket)
Get your connection string
Connect to Xata
- Standard (TCP)
- Serverless (HTTP)
- Serverless (WebSocket)
Use this for traditional servers and long-running applications:
Define your schema
Create aschema.ts file:
Query your database
Configure Drizzle Kit
Create adrizzle.config.ts file for migrations: