A Node.js CLI tool for incremental Cassandra schema migrations using the DataStax Cassandra driver. Current stable version is 1.2.333. It supports up/down migrations, automatic migration ordering by timestamp, and rollback to a specific migration number. Key differentiators: uses timestamped migration files, supports configuration via CLI flags, environment variables, or a JavaScript configuration file. The tool tracks applied migrations in a Cassandra table and can skip migrations. Note that version 1.1.2 introduced a migration table format change requiring an update migration.
npm install cassandra-migrateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Install the CLI, create a new migration, run it, and roll it back using command-line flags for keyspace and credentials.
Copy the provided 0000000000_updateMigrationTable.js migration into your migrations folder and run it before any other migrations.
Use -o <path/to/config.js> or set DBHOST, DBUSER, DBPASSWORD environment variables.
Use the `create` command to generate files with correct timestamps.
Ensure your config file uses module.exports = { ... } and is a .js file.Only skip migrations when you are certain the schema is already applied or unapplied manually.
Create the keyspace first with: CREATE KEYSPACE my_keyspace WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1};Run `cassandra-migrate up -k <keyspace>` with an empty migrations folder to create the table.
Start Cassandra service or provide correct host/port via -H flag or environment variables.
Rename the migration file to use a proper timestamp, e.g., 1546300800_my_migration.js. Better yet, use the `create` command.