Registry / devops / migraphile

migraphile

JSON →
library1.1.0-beta.7jsnpmunverified

A migration tool that combines Migra and Graphile Migrate to provide drift detection and migration generation for PostgreSQL databases. Current version 1.1.0-beta.7, pre-release. It wraps the Python-based Migra tool in a Docker container and integrates with Graphile Migrate's lifecycle hooks. Key differentiators: enables automatic drift fixing between shadow and local databases, and generates migration files based on ORM schema changes. Requires Docker to run Migra. Updated infrequently; beta status implies potential breaking changes.

npm install migraphile
INSTALL
IMPORT
SIG · MIGRAPHILE
M
migraphile
devopsjavascriptv1.1.0-beta.7
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fix_drift
npx migraphile fix_drift
import { fix_drift } from 'migraphile'
Migraphile is a CLI tool, not a JavaScript module. Use npx or yarn command.
generate
npx migraphile generate
require('migraphile').generate()
Generate command is run via CLI, not programmatically.
migraphile
yarn migraphile
const migraphile = require('migraphile')
The package provides CLI commands, not a JavaScript API.

Installs migraphile, sets up environment variables, and runs CLI commands for drift detection and migration generation.

yarn add migraphile # Ensure Docker is running, then configure .env: # DATABASE_URL=postgres://user:pass@localhost:54322/postgres # SHADOW_DATABASE_URL=postgres://user:pass@localhost:54322/shadow # ORM_DATABASE_URL=postgres://user:pass@localhost:54322/knex # ORM_NAME=Knex # OUTPUT_FILE_PATH=current/1-current.sql # SCHEMAS=public # Run drift detection: npx migraphile fix_drift # Generate migration: npx migraphile generate
Debug
Known issues
breakingVersion 1.0.0 used 'fix_drift' as a script, now it's a CLI command.
fix
Update to use 'npx migraphile fix_drift' instead of calling a script.
affects: <1.1.0
breakingDocker is required; Migra runs in a Docker container.
fix
Ensure Docker is installed and running before using migraphile.
affects: >=1.0.0
deprecatedMigraphile is in beta, may change significantly.
fix
Pin version and monitor releases for breaking changes.
affects: 1.1.0-beta.x
gotchaDATABASE_URL must equal APP_DATABASE_URL; graphile-migrate overrides DATABASE_URL.
fix
Set both DATABASE_URL and APP_DATABASE_URL to the same value in .env.
affects: >=1.0.0
gotchaRequires Python-based Migra via Docker; no direct JS implementation.
fix
Docker must be accessible; if running in CI, ensure Docker service is available.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Docker is not available. Please install Docker.
Docker is not installed or not running.
fix
Install Docker and start the Docker daemon.
Error: DATABASE_URL is not set.
Required environment variable missing.
fix
Set DATABASE_URL in .env file or environment.
Error: SHADOW_DATABASE_URL is not set.
Shadow database URL missing.
fix
Set SHADOW_DATABASE_URL in .env file.
Upgrade
Version history
1.1.0-beta.7latest on npm
Audit
Dependencies
graphile-migrateoptionalintegrated with graphile-migrate lifecycle hooks
dockerrequiredrequires Docker to run the Migra Python tool in a container
Agent activity
9 hits · last 30 days
node
8
Amazon
1
Resources
migraphile — npm install migraphile · libregistry