Registry / database / clunky-migration-tool

clunky-migration-tool

JSON →
library1.0.0jsnpmunverified

A version migration tool written in Bash for applying upgrades from a source to a target, commonly used for PostgreSQL database schema and data migrations. Current stable version is 1.0.0. It follows a release cadence of manual releases via GitHub. Key differentiators: it is source- and target-agnostic via a simple Bash function interface, supports both incremental and from-scratch migrations, and includes a built-in filetree source and psql target. It is minimal and fast compared to heavier alternatives like Flyway or Liquibase.

npm install clunky-migration-tool
INSTALL
IMPORT
SIG · CLUNKY-MIGRATION-T
C
clunky-migration-tool
databasejavascriptv1.0.0
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.

clunky-migration-tool
clunky-migration-tool -m filetree:psql
npx clunky-migration-tool
It is a Bash script, typically installed via git clone or curl and added to PATH. No npm import.
env var CMT_TARGET_PSQL_URI
CMT_TARGET_PSQL_URI=postgres://user:pwd@localhost:5432/app clunky-migration-tool -m filetree:psql
clunky-migration-tool -m filetree:psql -d postgres://user:pwd@localhost:5432/app
The URI is set via environment variable, not command-line argument.
env var CMT_TARGET_DEBUG_VERSION
CMT_TARGET_DEBUG_VERSION=v3 clunky-migration-tool -m filetree:debug v5
clunky-migration-tool -m filetree:debug -v CMT_TARGET_DEBUG_VERSION=v3 v5
Debug version is set via environment variable for dry-run display.

Installs the tool, sets up a PostgreSQL target, and runs a migration to the latest version, followed by a dry-run to a specific version.

#!/bin/bash # Install clunky-migration-tool from GitHub git clone https://github.com/ogheorghies/clunky-migration-tool.git /tmp/clunky-migration-tool export PATH=$PATH:/tmp/clunky-migration-tool/bin # Set up target database URI CMT_TARGET_PSQL_URI=postgres://user:pwd@localhost:5432/app # Run migration to latest version clunky-migration-tool -m filetree:psql # For a dry-run to version v5 CMT_TARGET_DEBUG_VERSION=v3 clunky-migration-tool -m filetree:debug v5
Debug
Known issues
gotchaThe tool is a Bash script and requires Bash 4+ for associative arrays and process substitution.
fix
Ensure /bin/bash is version 4 or later. On macOS, use 'brew install bash' and set shebang accordingly.
affects: >=0.0
gotchaThe psql target runs actual SQL against the database; no rollback is performed on failure beyond transaction scope. Ensure source_get_changes returns transactional changes.
fix
Wrap all migration SQL in a single transaction; the tool expects target_accept_changes to be transactional.
affects: >=0.0
gotchaVersion names must not contain special strings 'first', 'last', 'scratch' as they are reserved by the tool.
fix
Use version names like 'v1', 'v2', etc., avoiding reserved words.
affects: >=0.0
breakingThe tool sources and targets are Bash functions; if you rename or delete a source/target script mid-migration, it will fail.
fix
Never modify source/target implementations during a migration run.
affects: >=0.0
Errors
Common errors & fixes
source_get_version: Command not found
The source script is not sourced correctly or not executable.
fix
Ensure the source file is in the expected directory and sourced properly: source ./mysource.sh
psql: command not found
PostgreSQL client (psql) is not installed or not in PATH when using psql target.
fix
Install postgresql client (e.g., apt-get install postgresql-client) or adjust PATH.
target_get_current_version: unexpected EOF while looking for matching ``
A Bash syntax error in a target function due to missing backticks or quotes.
fix
Check the target script for unbalanced quotes or backticks, and ensure proper Bash syntax.
Upgrade
Version history
1.0.0latest on npm
Audit
Dependencies
psqloptionalRequired when using psql target for PostgreSQL migrations
Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
clunky-migration-tool — npm install clunky-migration-tool · libregistry