Registry / devops / migration-renamer

migration-renamer

JSON →
library0.0.4jsnpmunverified

Migration-renamer is a utility for renaming migration files, version 0.0.4. It is a small, focused tool designed to work with Postgrator-style migrations, providing a simple command-line interface for renaming migration files. It has minimal dependencies and is actively maintained. Differentiators include its simplicity and tight integration with the Postgrator migration tool.

npm install migration-renamer
INSTALL
IMPORT
SIG · MIGRATION-RENAMER
M
migration-renamer
devopsjavascriptv0.0.4
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.

default
import migrationRenamer from 'migration-renamer'
const migrationRenamer = require('migration-renamer')
The package is ESM-only, so require() will fail with ERR_REQUIRE_ESM.
renameMigration
import { renameMigration } from 'migration-renamer'
const renameMigration = require('migration-renamer').renameMigration
Named export available; using require with destructuring is incorrect for ESM packages.
MigrationRenamerOptions
import type { MigrationRenamerOptions } from 'migration-renamer'
import { MigrationRenamerOptions } from 'migration-renamer'
TypeScript users should use type import to avoid runtime errors.

Renames migration file from oldName to newName using default export, with directory option.

import migrationRenamer from 'migration-renamer'; const result = migrationRenamer({ directory: './migrations', oldName: '001_create_users', newName: '001_create_users_table' }); console.log(result); // { success: true, oldPath: '...', newPath: '...' }
Debug
Known issues
gotchaThe default export and named export 'renameMigration' are the same function; importing both may cause confusion.
fix
Use only one import style: either default or named.
affects: >=0.0.1
breakingVersion 0.0.4 removed support for CommonJS require(). The package now only works with ESM imports.
fix
Switch to ES modules (import syntax) or downgrade to 0.0.3.
affects: >=0.0.4
deprecatedThe 'dryRun' option is deprecated in favor of 'dry-run' (kebab-case) as of version 0.0.3.
fix
Use 'dry-run' instead of 'dryRun'.
affects: >=0.0.3
gotchaIf directory is not provided, the default is './migrations', which may not exist in all projects.
fix
Always provide an explicit directory path.
affects: >=0.0.1
gotchaThe oldName must include the full filename including extension; partial names may cause undefined behavior.
fix
Provide the complete old filename with extension.
affects: >=0.0.1
Errors
Common errors & fixes
Error [ERR_REQUIRE_ESM]: require() of ES Module
Attempting to use CommonJS require() on an ESM-only package.
fix
Use import syntax (ES modules) in your project or downgrade to version 0.0.3.
TypeError: migrationRenamer is not a function
Incorrect import due to using default import when it does not exist, or using named import with wrong casing.
fix
Ensure you use either default import (no curly braces) or named import with correct name.
ENOENT: no such file or directory, open './migrations/001_create_users.sql'
Missing directory or file specified in options.
fix
Verify that the directory path exists and the oldName file exists.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
postgratorrequiredUsed for migration management and file naming conventions
Agent activity
4 hits · last 30 days
node
4
Resources
migration-renamer — npm install migration-renamer · libregistry