Registry / database / db-migrate-cassandra

db-migrate-cassandra

JSON →
library0.0.5jsnpmunverified

A plugin for db-migrate that enables Cassandra database migrations using the cassandra-driver. Version 0.0.5 is the latest release. It supports common migration operations such as create/drop table, add/remove/rename column, and change column type. The package is intended to be used alongside db-migrate and currently has limited functionality (e.g., no keyspace creation). It is a niche tool for Node.js projects needing schema migrations for Cassandra.

npm install db-migrate-cassandra
INSTALL
IMPORT
SIG · DB-MIGRATE-CASSAND
D
db-migrate-cassandra
databasejavascriptv0.0.5
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
// No default import; used as a plugin with db-migrate
This package is a plugin for db-migrate and is not imported directly. It is loaded via db-migrate configuration.

Shows installation, configuration, and a sample migration to create a users table with primary key.

// 1. Install dependencies // npm install db-migrate db-migrate-cassandra // 2. Configure database.json // { // "cassandra": { // "driver": "cassandra", // "host": "localhost", // "port": 9042, // "keyspace": "mykeyspace" // } // } // 3. Create a migration file (e.g., 001-create-users.js) 'use strict'; exports.up = function (db, callback) { db.createTable('users', { 'name': 'varchar', 'age': 'int' }, { 'primary_key': 'name' }, callback); }; exports.down = function (db, callback) { db.dropTable('users', callback); }; // 4. Run migration from command line // npx db-migrate up --config database.json
Debug
Known issues
gotchaCassandra keyspace must exist before running migrations; no keyspace creation support.
fix
Create the keyspace manually via cqlsh or another tool before running migrations.
affects: >=0.0.0
gotchaMigration operations are limited compared to other databases; changeColumn and other DDL might not work as expected on all Cassandra versions.
fix
Test migrations thoroughly on your Cassandra cluster.
affects: >=0.0.0
gotchaThe package uses cassandra-driver under the hood; ensure the driver version is compatible.
fix
Check the cassandra-driver documentation for compatibility with your Cassandra version.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module 'db-migrate-cassandra'
Missing installation or incorrect configuration in database.json
fix
Run 'npm install db-migrate-cassandra' and ensure the driver field in database.json is set to 'cassandra'.
All host(s) tried for query failed
Cassandra server not running or incorrect host/port configuration
fix
Verify Cassandra is running and accessible at the configured host and port.
Keyspace 'mykeyspace' does not exist
Keyspace has not been created in Cassandra
fix
Create the keyspace manually: CREATE KEYSPACE mykeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
Upgrade
Version history
0.0.5latest on npm
Audit
Dependencies
db-migraterequiredRequired core migration framework
cassandra-driverrequiredCassandra database driver for Node.js
Agent activity
12 hits · last 30 days
node
10
Resources
db-migrate-cassandra — npm install db-migrate-cassandra · libregistry