Registry / database / migrate-rethinkdb

migrate-rethinkdb

JSON →
library1.6.2jsnpmunverified

A migration tool for RethinkDB, forked from rethink-migrate. Version 1.6.2, actively maintained by Parabol. Allows forward and backward migrations of structural or data changes with versioning. Supports both `rethinkdb` and `rethinkdbdash` drivers. Migration files are JavaScript modules with `up` and `down` exports. Configuration via `database.json` or environment variables. Key differentiator: more active maintenance than the original fork, supports `--root` and `--logLevel` options.

npm install migrate-rethinkdb
INSTALL
IMPORT
SIG · MIGRATE-RETHINKDB
M
migrate-rethinkdb
databasejavascriptv1.6.2
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.

migrate-rethinkdb CLI
Install globally and run `migrate-rethinkdb up`
Using `require('migrate-rethinkdb')` without global install
Package is primarily a CLI tool; API import is possible but not documented. Use `npx migrate-rethinkdb` if not installed globally.

Installs migrate-rethinkdb globally, installs rethinkdb driver, creates a database.json config, generates a migration scaffold, edits it to create/drop a table, and runs all pending migrations.

npm install -g migrate-rethinkdb npm install --save rethinkdb echo '{"host":"localhost","port":28015,"db":"mydb"}' > database.json migrate-rethinkdb create add-tables cat > ./migrations/$(ls -t ./migrations | head -1) << 'EOF' exports.up = function (r, connection) { return r.tableCreate('foo').run(connection); }; exports.down = function (r, connection) { return r.tableDrop('foo').run(connection); }; EOF migrate-rethinkdb up --all
Debug
Known issues
gotchaThe tool expects a RethinkDB driver to be installed separately; it does not bundle one.
fix
Run `npm install --save rethinkdb` (or rethinkdbdash) in your project before using migrate-rethinkdb.
affects: >=1.0.0
gotchaThe `database.json` file must be in the current working directory or the directory specified with `--root`.
fix
Ensure `database.json` exists in the root of your project or use `migrate-rethinkdb up --root ./path`.
affects: >=1.0.0
gotchaBy default, `migrate-rethinkdb up` runs all migrations (--all). If you only want one, use `--one`.
fix
Use `--one` flag to run a single migration instead of all: `migrate-rethinkdb up --one`.
affects: >=1.0.0
gotchaMigration files must export `up` and `down` functions that return promises. Omitting them may cause silent failures.
fix
Always define both `exports.up` and `exports.down` with functions that return a promise.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'rethinkdb'
RethinkDB driver not installed
fix
Run `npm install --save rethinkdb` (or retinkdbdash) in your project.
Error: ENOENT: no such file or directory, open 'database.json'
Missing configuration file in working directory
fix
Create a database.json file with your RethinkDB connection details.
migrate-rethinkdb: command not found
Package not installed globally or not in PATH
fix
Run `npm install -g migrate-rethinkdb` or use `npx migrate-rethinkdb`.
Upgrade
Version history
1.6.2latest on npm
Audit
Dependencies
rethinkdbrequiredRequired driver to communicate with RethinkDB (or rethinkdbdash as alternative)
rethinkdbdashoptionalAlternative driver if not using rethinkdb
Agent activity
10 hits · last 30 days
node
10
Resources
migrate-rethinkdb — npm install migrate-rethinkdb · libregistry