frossi85 / slick-migration-api   0.2.1

GitHub

Schema manipulation DSL for Slick

Scala versions: 2.11

Build Status Coverage Status

A library for defining database migrations, for use with Slick, including a DSL to define type safe and typo safe table migrations that are defined in terms of Slick table definitions.

Example:

implicit val dialect = new H2Dialect

val migrate =
  TableMigration(myTable)
    .create
    .addColumns(_.col1, _.col2)
    .addIndexes(_.index1)
    .renameColumn(_.col03, "col3") &
  SqlMigration("insert into myTable (col1, col2) values (10, 20)")

withSession { implicit session: Session =>
  migrate()
}

Note: Some test in MySql could fail, please see: https://www.farbeyondcode.com/Solution-for-MariaDB-Field--xxx--doesn-t-have-a-default-value-5-2720.html