Registry / database / cql-migration

cql-migration

JSON →
library1.0.13jsnpmunverified

CQL Migration is a simple command-line migration tool for Apache Cassandra, using CQL (Cassandra Query Language) files. Current stable version is 1.0.13. It provides basic up and down migration commands with configurable counts. The tool reads migration files from a specified directory, parses up/down sections separated by '---' markers, and applies them to a Cassandra cluster. It differs from more complex migration frameworks by its minimal configuration and dependency on a single npm package. Requires Node.js and Cassandra driver.

npm install cql-migration
INSTALL
IMPORT
SIG · CQL-MIGRATION
C
cql-migration
databasejavascriptv1.0.13
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Global installation of cql-migration, creation of config file and a sample migration, then running up and down commands.

npm i -g cql-migration # Create .migration.js config cat > .migration.js <<EOF module.exports = { dir: './migrations', url: '127.0.0.1:9042', keyspace: 'mykeyspace', username: 'cassandra', password: process.env.CASSANDRA_PASS || '', dataCenter: 'datacenter1', extraOptions: {} } EOF mkdir -p migrations cat > migrations/1_create_users.cql <<EOF --- up CREATE TABLE users ( id UUID PRIMARY KEY, name text ) --- down DROP TABLE users; EOF # Run migration up cql-migration up 1 # Check status (no built-in command, but tables should exist) # Run migration down 1 cql-migration down 1
Debug
Known issues
gotchaConfig file must be exactly named '.migration.js' in the working directory; other filenames are not supported.
fix
Rename config file to '.migration.js' or create symlink.
affects: >=0.0.0
gotchaMigration files must have a version prefix and name separated by underscore; e.g., '1_create.cql'. Non-conforming files are silently ignored.
fix
Ensure migration files follow the pattern '[VERSION]_[NAME].cql' or '[VERSION]_[NAME].sql'.
affects: >=0.0.0
gotchaDown command default count is 1, but the description says 'count default 1' - this may cause unintended reversions if count is not specified.
fix
Always specify count explicitly when running down to avoid accidental rollbacks.
affects: >=0.0.0
Errors
Common errors & fixes
Error: Cannot find module './.migration.js'
Config file is not in the current working directory or named incorrectly.
fix
Create file '.migration.js' in the current directory with the required configuration.
TypeError: Cannot read property 'dir' of undefined
Config file exports an incorrect object or is malformed.
fix
Check that .migration.js exports a valid object with required fields: dir, url, keyspace, username, password, dataCenter.
All hosts in query plan are down or unreachable
Cassandra server is not running or the connection URL is incorrect.
fix
Start Cassandra, verify connection URL (default 127.0.0.1:9042), and check network/firewall.
The keyspace 'mykeyspace' does not exist
Specified keyspace in config does not exist in Cassandra.
fix
Create keyspace in Cassandra first, e.g., CREATE KEYSPACE mykeyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
Upgrade
Version history
1.0.13latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
13 hits · last 30 days
node
12
OpenAI (training)
1
Resources
cql-migration — npm install cql-migration · libregistry