inoio / sbt-pillar-plugin   2.1.3

Apache License 2.0 GitHub

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

Scala versions: 2.12 2.10
sbt plugins: 1.0 0.13

sbt-pillar-plugin - manage Cassandra migrations from sbt

Join the chat at Build Status Maven Central

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 1.0 and 0.13.


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

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


Add appropriate configuration to build.sbt like this:




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

pillarConfigKey := "cassandra.url"

pillarReplicationStrategyConfigKey := "cassandra.replicationStrategy"

pillarReplicationFactorConfigKey := "cassandra.replicationFactor"

pillarDefaultConsistencyLevelConfigKey := "cassandra.defaultConsistencyLevel"

pillarReplicationStrategyConfigKey := "cassandra.replicationStrategy"

pillarDatacenterNamesConfigKey := "cassandra.datacenterNames"

pillarMigrationsDir := file("conf/migrations")

pillarExtraMigrationsDirs := Seq(file("conf/extra-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://".

The pillarMigrationsDir contains the directory with the cql-files to process. It's processed recursively, therefore files in subfolders are picked up as well.

The pillarReplicationStrategyConfigKey is optional, the default value is SimpleStrategy. NetworkTopologyStrategy is also supported.

The pillarDatacenterNamesConfigKey is only used if the NetworkTopologyStrategy is chosen. You can place your datecenter names here in a list ["eu", "na", "sa"]. This will result in the following replication class: replication = {'class': 'NetworkTopologyStrategy', 'eu': '3', 'na': '3', 'sa': '3'}

The pillarReplicationFactorConfigKey is optional, the default value is 3.

The pillarDefaultConsistencyLevelConfigKey is optional, the default value is QUORUM.

The pillarExtraMigrationsDirs is optional, the default is Seq.empty. Here you can add directories containing extra migration files, which will be processed in addition to the ones in pillarMigrationsDir.


The sbt pillar plugin provides the following tasks:

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

Migrate to sbt-pillar 2.13 and sbt 1.0

Since SBT 1.0 is in scope which makes it necessary to change imports from import io.ino to import When moving to sbt-pillar 2.13 replace pillarSettings in your configuration with sbtpillar.Plugin.pillarSettings.


The license is Apache 2.0, see LICENSE.txt.