Skip to content

Simple python script for generate, execute and rollback schema migrations in Cassandra.

Notifications You must be signed in to change notification settings

aloon/cassandra-migrations

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 

Repository files navigation

Schema migration for Cassandra

Simple python script for generate, execute and rollback schema migrations in Cassandra.

Installation

Download the script, give execution permission and install the python dependencies

$ chmod +x cassandra-migrations.py
$ pip install cassandra-driver
$ pip install blist

Usage

Create migration

./cassandra-migrations.py generate {keyspace} {MigrationName}

This creates a new file like: ./migrations/{keyspace}/20140914222010_{MigrationName}.xml

<?xml version="1.0" ?>
<migration>
    <up>
	    <cql><![CDATA[
Here cql up
	    ]]></cql>
	</up>
	<down>
  	    <cql><![CDATA[
Here cql down
		]]></cql>
	</down>
</migration>

Execute migration

$ ./cassandra-migrations.py migrate {keyspace}

or

$ ./cassandra-migrations.py migrate {keyspace} {serverIP}

rollback migration

$ ./cassandra-migrations.py rollback {keyspace}

Change Log

2015-01-02

  • Enables multiple CQL up/down executions in the same migration
  • Ability to have migrations for multiple keyspaces with single installation
  • Updated default migration XML template
  • Added support for remote server migrations
  • Better notifications and warnings/errors when running
  • Help documentation

About

Simple python script for generate, execute and rollback schema migrations in Cassandra.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages