Skip to content

sbt plugin for pillar - manage migrations for your Cassandra data stores

License

Notifications You must be signed in to change notification settings

manuelkiessling/sbt-pillar-plugin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

sbt-pillar-plugin - manage Cassandra migrations from sbt

Build Status

This sbt plugin allows to run Cassandra schema/data migrations from sbt (using pillar). For details on migration files check out the pillar documentation. The cassandra connection configuration is not based on pillar but we're using our own format (see Configuration).

The plugin is built for sbt 0.13.

Installation

To install the plugin you have to add it to project/plugins.sbt:

addSbtPlugin("io.ino" %% "sbt-pillar-plugin" % "2.0.0 ")

Configuration

Add appropriate configuration to build.sbt like this:

import io.ino.sbtpillar.Plugin.PillarKeys._

...

pillarSettings

pillarConfigFile := file("conf/application.conf")

pillarConfigKey := "cassandra.url"

pillarReplicationStrategyConfigKey := "cassandra.replicationStrategy"

pillarReplicationFactorConfigKey := "cassandra.replicationFactor"

pillarDefaultConsistencyLevelConfigKey := "cassandra.defaultConsistencyLevel"

pillarMigrationsDir := file("conf/migrations")

The shown configuration assumes that the url for your cassandra is configured in conf/application.conf under the key cassandra.url and that pillar migration files are kept in conf/migrations (regarding the format of migration files check out the pillar documentation).

The cassandra.url has to follow the format cassandra://<host>:<port>/<keyspace>?host=<host>&host=<host>, e.g. it would be cassandra.url="cassandra://192.168.0.10:9042/my_keyspace?host=192.168.0.11&host=192.168.0.12".

The pillarReplicationStrategyConfigKey is optional, the default value is SimpleStrategy. The pillarReplicationFactorConfigKey is optional, the default value is 3. The pillarDefaultConsistencyLevelConfigKey is optional, the default value is QUORUM.

Usage

The sbt pillar plugin provides the following tasks:

createKeyspace
Creates the keyspace (and creates pillar's applied_migrations table)
dropKeyspace
Drops the keyspace
migrate
Runs pillar migrations (assumes createKeyspace was run before)
cleanMigrate
Recreates the keyspace (drops if exists && creates) and runs pillar migrations (useful for continuous integration scenarios)

License

The license is Apache 2.0, see LICENSE.txt.

About

sbt plugin for pillar - manage migrations for your Cassandra data stores

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Scala 100.0%