Registry / database / npmw-sql-migrate

npmw-sql-migrate

JSON →
library1.8.1jsnpmunverified

An NPM wrapper for the Go-based sql-migrate database migration tool. Version 1.8.1 provides OS-agnostic native binaries for Windows, macOS, and Linux without requiring Go installation. The package uses optional dependencies to download only the relevant binary for the target platform, keeping node_modules small. It supports all sql-migrate commands (up, down, status, new) via npx or global install. Key differentiators: zero Go dependencies, CI/CD friendly with tiny footprint, and automatic architecture detection. Updates follow sql-migrate releases, currently wrapping v1.6.0.

npm install npmw-sql-migrate
INSTALL
IMPORT
SIG · NPMW-SQL-MIGRATE
N
npmw-sql-migrate
databasejavascriptv1.8.1
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.

Package
import * as pkg from 'npmw-sql-migrate'
This package is a CLI tool; you typically use it via npx or as a global command. There is no programmatic API to import.

Shows how to configure and run database migrations using npx without installing the package globally.

#!/bin/bash # Create dbconfig.yml cat > dbconfig.yml <<EOF development: dialect: mysql datasource: root:password@tcp(127.0.0.1:3306)/my_db?parseTime=true dir: migrations EOF # Create a migration directory mkdir -p migrations # Create a new migration npx sql-migrate new create_users # Apply all pending migrations npx sql-migrate up EOF
Debug
Known issues
gotchaThe package uses optional dependencies; npm install may fail if the binary for your platform is not available. Ensure your platform is supported (Windows x64, macOS Intel/Apple Silicon, Linux x64/ARM64).
fix
Verify your OS and architecture are listed in the supported platforms. Use npm install --ignore-optional to skip binary download if you plan to use a different method.
affects: >=1.0
gotchanpx sql-migrate up may fail if the config file is not named exactly dbconfig.yml or placed in the project root. The tool does not support alternative config file paths.
fix
Place a dbconfig.yml in the root directory of your project.
affects: >=1.0
gotchaThis wrapper only works with sql-migrate v1.6.0 binaries. You cannot use newer sql-migrate versions or custom binaries.
fix
To use a different version of sql-migrate, install the Go tool directly.
affects: >=1.0
deprecatedThe package is community-maintained and may lag behind sql-migrate releases. Check the binary version included.
fix
Consider using the official sql-migrate binary directly if you need the latest features.
affects: >=1.0
Errors
Common errors & fixes
Error: Binary for platform 'win32-arm64' not found
The package does not bundle a binary for Windows ARM64.
fix
Use a Windows x64 system or run the Go tool directly.
npx: command not found: sql-migrate
The npmw-sql-migrate package is not installed in the local project or globally.
fix
Run 'npm install --save-dev npmw-sql-migrate' in your project root.
sql-migrate: No configuration file found (./dbconfig.yml)
The dbconfig.yml file is missing or not in the current working directory.
fix
Create a dbconfig.yml in the directory where you run the command.
Error: Cannot find module 'npmw-sql-migrate'
The package is not installed when using require() or import. However, the package is not designed for programmatic use.
fix
Use 'npx sql-migrate' from the command line instead of importing.
Upgrade
Version history
1.8.1latest on npm
Audit
Dependencies
npmw-sql-migrate-win-x64optionalOptional dependency: Windows x64 binary
npmw-sql-migrate-linux-x64optionalOptional dependency: Linux x64 binary
npmw-sql-migrate-linux-arm64optionalOptional dependency: Linux ARM64 binary
npmw-sql-migrate-darwin-x64optionalOptional dependency: macOS Intel binary
npmw-sql-migrate-darwin-arm64optionalOptional dependency: macOS Apple Silicon binary
Agent activity
5 hits · last 30 days
node
4
Resources
npmw-sql-migrate — npm install npmw-sql-migrate · libregistry