Rhinozug CLI

raw JSON →
0.1.9 verified Sat Apr 25 auth: no javascript

A database migration CLI tool built by Rhinogram for managing PostgreSQL schema changes programmatically. Version 0.1.9 is the latest stable release; release cadence is irregular. It wraps Knex.js to provide an opinionated migration workflow with 'up' and 'down' commands, timestamped migration files, and custom templates. Unlike standalone tools like Knex CLI, Rhinozug is designed as a global npm package and uses a project-local initialization (`rz init`) to create config and migration directories. It is intended primarily for Rhinogram's internal use, but is publicly available on npm.

error Error: Cannot find module 'rhinozug-cli'
cause The package is not installed globally or you are not using npx.
fix
Run 'npm install -g rhinozug-cli' or use 'npx rhinozug-cli <command>'.
error rz: command not found
cause The global bin path is not in your PATH or the package was not installed globally.
fix
Install globally: 'npm install -g rhinozug-cli'. Check PATH or call 'npx rhinozug-cli'.
error Error: ENOENT: no such file or directory, open 'config/migration.template'
cause 'rz init' has not been run in the current project.
fix
Run 'rz init' from the project root.
gotcha The 'rz' alias may conflict with other tools that use 'rz' command.
fix Use 'rhinozug' instead of 'rz' or check for existing 'rz' command.
gotcha Migrations must be idempotent: the 'down' must exactly undo the 'up'.
fix Always test 'rz down' immediately after 'rz up' to ensure database state is restored.
gotcha If the project does not have a package.json, 'rz init' will fail.
fix Run 'npm init -y' before 'rz init'.
gotcha The target file in 'rz up -t' must be the full filename including timestamp.
fix Use the exact migration filename as shown in 'rz list:m'.
npm install rhinozug-cli
yarn add rhinozug-cli
pnpm add rhinozug-cli

Demonstrates installing globally, initializing a project, creating a migration, running it, and listing migration status.

npm install -g rhinozug-cli
mkdir my-project && cd my-project
npm init -y
rz init
rz create:migration add_users_table
# Edit migrations/20220314120000_add_users_table.js:
# exports.up = (knex) => knex.schema.createTable('users', (t) => { t.increments(); t.string('name'); });
# exports.down = (knex) => knex.schema.dropTable('users');
rz up
rz list:m