https://github.com/jsdir/cql-migrate
Derives deltas and migrates between output schemas from datastored's cassandra adapter
https://github.com/jsdir/cql-migrate
Last synced: about 1 year ago
JSON representation
Derives deltas and migrates between output schemas from datastored's cassandra adapter
- Host: GitHub
- URL: https://github.com/jsdir/cql-migrate
- Owner: jsdir
- License: mit
- Created: 2014-08-06T05:26:41.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-08-06T06:21:33.000Z (over 11 years ago)
- Last Synced: 2025-02-06T16:28:28.707Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 164 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
cql-migrate
===========
Derives deltas and migrates between output schemas from datastored's cassandra adapter
Installation
------------
`npm install -g cql-migrate`
Usage
-----
### Saving migrations
To save a new migration, pipe in the new schema to `cql-migrate add`.
```sh
$ # Use an automatic script...
$ node ./generate_schema.js | cql-migrate add -n "first migration"
$ # or use a file.
$ cql-migrate < schema.json
```
If the nme parameter `-n` is not given, you will be prompted for the migration name.
Migrations will be saved in the same naming format used by [ActiveRecord](http://guides.rubyonrails.org/migrations.html):
`YYYYMMDDHHMMSS_migration_name.json`
The migration name will have spaces replaced with underscores, and the entire name will be made lowercase.
### Applying migrations
To migrate to the latest unapplied migration, just run the command by itself:
```sh
$ cql-migrate
```
To migrate to a specific migration, give the schema filename:
```sh
$ cql-migrate 20000101000000_happy_new_year.json
```
A state file is saved in the migration state directory. This will let future migrations know the state of the database and will determine what delta to apply. Since the schema of the latest migration is also saved as state, migrations can be reversed without having to find the last migration. It will already be available in state.