Database
Supported Providers
ShipAny TanStack uses Drizzle ORM. Set DATABASE_PROVIDER + DATABASE_URL:
| Provider | DATABASE_URL example | Notes |
|---|---|---|
sqlite | file:data/local.db | Default — zero setup for local dev |
postgres | postgresql://user:pass@localhost:5432/dbname | Optional DB_SCHEMA |
mysql | mysql://user:pass@localhost:3306/dbname | MySQL 5.7+ |
turso | libsql://your-db.turso.io | Plus DATABASE_AUTH_TOKEN |
d1 | (D1 binding, no URL) | Cloudflare Workers deploys |
Switching Providers
# 1. Edit .env.development: DATABASE_PROVIDER + DATABASE_URL
# 2. Copy the matching schema template (.sqlite/.postgres/.mysql) to schema.ts
pnpm db:setup
# 3. Apply the schema
pnpm db:pushThe schema lives at src/config/db/schema.ts, generated from dialect-specific templates (schema.sqlite.ts, schema.postgres.ts, schema.mysql.ts).
Migration Workflow
- Development —
pnpm db:pushapplies schema changes directly, no SQL files. - Production — generate versioned migrations and run them:
pnpm db:generate # writes .sql migration files into ./drizzle
pnpm db:migrate # runs pending migrations- Browse data —
pnpm db:studioopens Drizzle Studio.
Tables
| Group | Tables |
|---|---|
| Auth | user, session, account, verification |
| Content | config, taxonomy (categories), post |
| Business | order, subscription, credit, apiKey, inviteCode, userRole, role, permission, rolePermission |