migrate

Generate versioned SQLite migrations from Drizzle schema changes and mirror them into the Go embed.

4|Updated Jul 30, 2026
One-click install
npx skills add https://github.com/gabriellst/codm --skill migrate-gabriellst
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: migrate
Source: https://github.com/gabriellst/codm/tree/main/.claude/skills/migrate
Command: npx skills add https://github.com/gabriellst/codm --skill migrate-gabriellst

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? After schema design is complete, developers still need to turn Drizzle schema changes into versioned SQL that applies correctly across two runtimes — a TypeScript daemon and a Go gateway sharing one SQLite file and one migration ledger. This Skill automates that generation, mirroring, and verification workflow while preventing ledger divergence and silent data loss. ## Core Features & Use Cases - Migration Generation: Runs bun migrate:create (drizzle-kit generate) to produce versioned SQL and snapshots from the contracts schema. - Go Embed Mirroring: Syncs the SQL into the Go //go:embed directory with db:sync-go and enforces byte-equality via db:check-go. - Safety Review Guidance: Flags SQLite table rebuilds, CHECK constraint carry-over, and destructive migration risks before SQL reaches a runtime. - Use Case: After updating packages/contracts/src/db/sqlite/*.ts with a new table, run this Skill to generate the migration, mirror it into the Go gateway, and verify both migrators apply it from cold and no-op on a second pass. ## Quick Start Generate and verify a SQLite migration for the schema changes I just made with db-modelling.

Frequently Asked Questions about migrate

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a Drizzle migration for SQLite?

Run `bun migrate:create`, which invokes drizzle-kit generate with the sqlite drizzle.config.ts and writes SQL plus a snapshot into the contracts migrations directory. With no schema changes it prints a message and writes nothing, so the command is idempotent.

How do I keep Go embed migrations in sync with Drizzle?

Run `bun run --cwd packages/contracts db:sync-go` to copy the SQL into the Go //go:embed directory, then verify with `db:check-go`. The embed copy is derived and must stay byte-identical because the shared ledger is keyed by filename.

Why does SQLite migration cause a table rebuild?

SQLite has no ALTER COLUMN, so changing a column's type or constraints makes Drizzle emit a rebuild: create new table, copy data, drop, rename. Review these migrations line by line since they are the ones that lose data quietly.

Why do the gateway and daemon disagree about a table?

This is almost always a drifted Go embed copy. Run `db:check-go`; if it reports a content mismatch, re-run `db:sync-go` and rebuild the Go binary, since an already-compiled gateway carries the old bytes.

Can I use drizzle-kit migrate to apply migrations?

No. drizzle-kit migrate writes its own __drizzle_migrations ledger, creating a second applier that diverges from the boot migrators. Use `bun migrate:dev` instead, which delegates to the same migrateEmbeddedDatabase function the boot path uses.