database-development
SolidDatabase migrations and Drizzle ORM guidelines for the vm0 project
API & Backend 1,138 stars
69 forks Updated today NOASSERTION
Install
Quality Score: 77/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# Database Development
## Commands
```bash
cd turbo/packages/db
pnpm db:generate # Generate migration from schema changes
pnpm db:migrate # Run pending migrations
pnpm db:studio # Open Drizzle Studio UI
```
## Migration Workflows
### Auto-Generated (simple changes)
```bash
# 1. Edit schema in src/schema/
# 2. Generate migration (auto-updates _journal.json and snapshot)
pnpm db:generate
# 3. Run locally
pnpm db:migrate
```
### Custom SQL (renames, complex ALTER, data transforms)
Use `drizzle-kit generate --custom` to create an empty migration file managed by Drizzle.
This auto-updates `_journal.json` and snapshot — **never edit these manually**.
```bash
# 1. Generate empty migration file
pnpm drizzle-kit generate --custom --name=rename_foo_to_bar
# 2. Write SQL in the generated file
# 3. Update schema file to match
# 4. Run locally
pnpm db:migrate
```
## Data Migration Scripts (Clerk API)
When a data migration requires **external API calls** (e.g., reading from Clerk),
it cannot be done in a SQL migration. These scripts live in:
```
turbo/packages/db/scripts/migrations/NNN-description/
├── backfill.ts # (or sync.ts) — the migration script
└── README.md # Usage, prerequisites, verification steps
```
Pure data transforms that only touch the database should use regular SQL migrations instead.
### Convention
- **Numbered sequentially**: `001-`, `002-`, etc. — never reuse numbers
- **Permanent**: these scripts are historical records and MUST NOT be del...
Details
- Author
- vm0-ai
- Repository
- vm0-ai/vm0
- Created
- 8 months ago
- Last Updated
- today
- Language
- TypeScript
- License
- NOASSERTION
Similar Skills
Semantically similar based on skill content — not just same category
API & Backend Solid
db-migrations
Create a database migration with Drizzle on a fresh Neon branch. Use when changing the packages/db schema or generating migrations.
12,636 Updated today
superset-sh API & Backend Listed
db-migration
Make a database schema change safely — edit schema.ts, generate the migration, review the SQL, apply it. Use for any change under src/db/.
7 Updated 2 days ago
nikandr-surkov API & Backend Solid
api-database-drizzle
Drizzle ORM, queries, migrations
18 Updated 1 weeks ago
agents-inc