Kysely-Mig is a TypeScript-first command-line interface (CLI) tool designed to manage database migrations and seeding for PostgreSQL databases, built on top of the Kysely query builder. The current stable version is 0.9.1, indicating it's still in active development, likely with frequent updates as features are added or refined. Key differentiators include atomic operations, automatic rollback on errors, transaction support, migration locking, multi-environment configuration, and selective/partial migration execution. It provides both a robust CLI for schema evolution and a programmatic API for integrating migration logic directly into applications, simplifying database management for Kysely users.
npm install kysely-migVerified import paths — ran on the pinned version, not inferred.
Demonstrates the initial setup, environment configuration, migration generation, and execution using the `kysely-mig` CLI.
Always review the changelog before upgrading to new minor versions (e.g., from 0.9.x to 0.10.x) to identify potential breaking changes or API alterations.
For CI/CD or container environments, ensure `$USER_HOME` is appropriately set and has write permissions, or consider manually copying configuration files into the expected location within the container/environment using a custom volume or initialization script.
Ensure your project exclusively uses PostgreSQL. If you require other databases, consider alternative migration tools or monitor the kysely-mig roadmap for broader database support.
Consider installing `kysely-mig` as a `devDependency` in your project (`npm install --save-dev kysely-mig`) and running it via `npx kysely-mig` or through npm scripts (`"migrate": "kysely-mig up"`) to ensure project-specific versioning and avoid global conflicts.
Run `npm install -g kysely-mig` again. If the problem persists, check your npm global installation directory (e.g., `npm root -g`) and ensure it's included in your system's PATH environment variable.
Ensure you have generated an environment file (`mig env generate <filename>`), filled in the database details, added it to the migrator's context (`mig env add <filename>`), and explicitly set it as the current environment (`mig env set <filename>`). Verify the environment name matches exactly.
Verify the environment file exists at the path you provided to `mig env add`, and that the filename matches what's expected. You may need to remove (`mig env rm <filename>`) and re-add the environment if its location or name changed, or if there were file permission issues.
No dependency data recorded yet.