vk migrate
vk migrate [options]vk migrate status [options]vk migrate applies pending .sql files from db/migrations/ (and
optionally db/seeds/) to the target database. It delegates to
@venturekit/data’s built-in pure-SQL runner — no external CLI, no
Java install, no schema-generation step. Applied files are tracked in
the __vk_migrations and __vk_seeds tables, and their content hash
is locked once recorded.
Subcommands
Section titled “Subcommands”vk migrate
Section titled “vk migrate”Apply pending schema migrations from db/migrations/.
vk migratevk migrate --seedvk migrate --env prod| Option | Description | Default |
|---|---|---|
-e, --env <env> | Target environment (sets VENTURE_STAGE) | inherits shell |
--seed | Also apply pending seeds from db/seeds/ after migrations | false |
vk migrate status
Section titled “vk migrate status”Show which migrations and seeds have already been applied vs. pending. Read-only — touches no rows.
vk migrate statusvk migrate status --env prod| Option | Description | Default |
|---|---|---|
-e, --env <env> | Target environment (sets VENTURE_STAGE) | inherits shell |
File Layout
Section titled “File Layout”my-app/├── db/│ ├── migrations/│ │ ├── 0001_init.sql│ │ └── 0002_add_users.sql│ └── seeds/ # optional│ └── 0001_demo_data.sql└── ...Files are applied in lexical order, one per transaction. Use a numeric
prefix (0001_…, 0002_…) so order is unambiguous.
Tracking Tables
Section titled “Tracking Tables”The runner creates two bookkeeping tables on first use:
__vk_migrations— schema migrations applied so far (version, hash, applied_at)__vk_seeds— seeds applied so far (same shape)
Once a file is recorded as applied, its content hash is frozen. Editing
the file produces a MigrationHashMismatchError on the next run —
write a follow-up migration instead.
Environment Variables
Section titled “Environment Variables”The runner connects via the granular DB_* vars; DATABASE_URL is
parsed into them automatically if set.
| Variable | Description |
|---|---|
DATABASE_URL | Postgres connection string (parsed into DB_HOST/DB_PORT/DB_USER/DB_PASSWORD/DB_NAME/DB_SSL) |
DB_HOST / DB_PORT / DB_USER / DB_PASSWORD / DB_NAME / DB_SSL | Granular alternative to DATABASE_URL |
VENTURE_STAGE | Environment name (set by --env flag) |
.env and .env.local (later wins) are loaded automatically from the
current working directory.
Other Migration Tools
Section titled “Other Migration Tools”MigrationConfig.tool also accepts 'drizzle', 'flyway',
'golang-migrate', and 'prisma' as future-extension points, but those
runners are not yet wired up — calling vk migrate with one of those
values throws MigrationToolNotImplementedError. For now, use the
established tool’s CLI directly:
- Drizzle Kit — run
drizzle-kit migrateagainst your owndrizzle.config.tsfrom your deploy pipeline. - Flyway — use
getFlywayEnv()from@venturekit/datato populateFLYWAY_*env vars and invoke theflywayCLI directly. - golang-migrate / Prisma Migrate — invoke their CLIs in your deploy pipeline as you would in any other project.