Registry / database / rethinkdb-migration

rethinkdb-migration

JSON →
library1.1.0jsnpmunverified

RethinkDB migration tool for Node.js applications (v1.1.0). Manages database schema evolution with support for environment-specific migrations (stage, uat, etc.). Uses configuration via environment variables or JSON config file. Features automatic migration script generation, pre/post scripts, and migration history tracking. Requires Node >=8.9.4. No updates since 2018; consider fork or replacement for active support.

npm install rethinkdb-migration
INSTALL
IMPORT
SIG · RETHINKDB-MIGRATIO
R
rethinkdb-migration
databasejavascriptv1.1.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.

migration script (up function)
async function up(rethink, migrate) { await rethink.getReQL().tableCreate('exampleTable').run(); await migrate.finishMigrationScript(); }
function up(rethink, migrate) { rethink.getReQL().tableCreate('exampleTable').run(); }
up function must be async and call migrate.finishMigrationScript() to record the migration.
module.exports
module.exports = { up };
export function up(rethink, migrate) { ... }
The package uses CommonJS. ES module syntax is not supported.
createMissingTables
await rethink.createMissingTables('tableName');
rethink.createMissingTables('tableName')
Method is async and must be awaited, though not explicitly documented.

Generates a migration script, shows the template with table creation, and runs the migration tool via CLI.

const { exec } = require('child_process'); // Generate a migration script exec('node rethinkdb-migration -cs create-users --config="./config.json"', (err, stdout) => { if (err) console.error(err); else console.log(stdout); }); // Migration file content (e.g., ./migrate/20250101_1200-create-users.js): async function up(rethink, migrate) { await rethink.getReQL().tableCreate('users').run(); await migrate.finishMigrationScript(); } module.exports = { up }; // Run migration exec('node rethinkdb-migration --config="./config.json"', (err, stdout) => { if (err) console.error(err); else console.log('Migration complete:', stdout); });
Debug
Known issues
breakingThe package uses Node.js fs and path APIs that may be deprecated or changed in newer Node versions.
fix
Use Node 8.9.4 - 10.x or test compatibility.
affects: >=8.9.4
deprecatedrethinkdb-migration has no updates since 2018. RethinkDB itself is not actively maintained.
fix
Consider alternative databases like PostgreSQL or a maintained migration tool.
affects: >=1.0.0
gotchaConfiguration file must be valid JSON, and the 'DIR_IMPLEMENTATION' key must be an empty string if not used, not null.
fix
Set "DIR_IMPLEMENTATION": "" in config JSON.
affects: >=1.0.0
gotchamigrate.finishMigrationScript() must be called exactly once per migration; otherwise the migration is not recorded and may re-run.
fix
Ensure await migrate.finishMigrationScript() is called after all operations.
affects: >=1.0.0
Errors
Common errors & fixes
node rethinkdb-migration -cs my-migration --config="./config.json"
Missing config file or incorrect path.
fix
Ensure config.json exists with required fields such as DB_HOST, DB_PORT, DB_NAME.
Error: Cannot find module 'rethinkdb-migration'
Package not installed globally or locally.
fix
Run 'npm install rethinkdb-migration' in the project directory.
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
10 hits · last 30 days
node
8
Amazon
1
Resources
rethinkdb-migration — npm install rethinkdb-migration · libregistry