Skip to content


Subversion checkout URL

You can clone with
Download ZIP
dbdeploy plugin for SBT
Branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.

dbdeploy plugin for sbt 0.11+

Instructions for use:

Step 1: Include the plugin in your build

Add the following to your project/plugins.sbt:

resolvers += Resolver.url("scalasbt", new URL(""))(Resolver.ivyStylePatterns)

addSbtPlugin("mrken" %% "sbt-dbdeploy" % "0.1")

libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.20" // JDBC driver library

Step 2: Add sbt-dbdeploy settings to your build

Add the following to your 'build.sbt'

import mrken.DbDeployPlugin

seq(DbDeployPlugin.dbDeploySettings: _*)

dbDeployUserId := ""

dbDeployPassword := Some("")

dbDeployDriver := "com.mysql.jdbc.Driver"

dbDeployUrl := "jdbc:mysql://localhost:3306/test"

Or if you are using a build object extending from Build:

import sbt._
import sbt.Keys._
import mrken.DbDeployPlugin._

object Build extends sbt.Build {

  val project = Project("foo", file("."),
    settings = Defaults.defaultSettings ++ dbDeploySettings ++ Seq(
      dbDeployUserId := "",
      dbDeployPassword := Some(""),
      dbDeployDriver := "com.mysql.jdbc.Driver",
      dbDeployUrl := "jdbc:mysql://localhost:3306/test",


Step 3: create the default delta script directory


If you want to specify a different location for your delta scripts, you need to set the dbDeployDir setting (see below).


dbdeploy -- runs dbdeploy


dbDeployDriver Specifies the jdbc driver Yes
dbDeployUrl Specifies the url of the database that the deltas are to be applied to. Yes
dbDeployUserId The ID of a dbms user who has permissions to select from the schema version table. Yes
dbDeployPassword The password of the dbms user who has permissions to select from the schema version table. No
dbDeployDir Full or relative path to the directory containing the delta scripts. No, default src/main/dbdeploy
dbDeployChangeLogTableName The name of the changelog table to use. Useful if you need to separate DDL and DML when deploying to replicated environments. If not supplied defaults to "changelog" No
dbDeployLastChangeToApply The highest numbered delta script to apply. No
dbDeployUndoOutputfile The name of the undo script that dbdeploy will output. Include a full or relative path. No
dbDeployEncoding The character encoding used for the input sql files and, if specified, all output files. Defaults to UTF-8 on all platforms. No

The following parameters only apply in "direct to db" mode:

dbDeployDelimiter Delimiter to use to separate scripts into statements. Default ; No
dbDeployDelimiterType either normal: split on delimiter wherever it occurs or row only split on delimiter if it features on a line by itself. Default normal. No
dbDeployLineEnding How to separate lines in sql statements issued via jdbc. The default platform uses the appropriate line ending for your platform and is normally satisfactory. However a bug in some oracle drivers mean that the Windows default of CRLF may not always work. See  issue 43 , use this parameter if you hit this issue. Supports platform, cr, lf, crlf. No

The following parameters only apply in "output script" mode:

dbDeployOutputFile The name of the script that dbdeploy will output. Include a full or relative path. No
dbDeplyDbms The target dbms. (In "direct to db" mode, all dbdeploy-generated commands are database agnostic, so this parameter is not required.) No
dbDeployTemplateDir Directory to read customised template scripts from No

For more info: and

Something went wrong with that request. Please try again.