Back to directory
nafg avatar

slick-migration-api

Schema manipulation dialects and DSL for Slick. Read more below about its uses, features, and usage.

Clone repository

git clone https://github.com/nafg/slick-migration-api.git

124

Stars

20

Forks

4

Watchers

Apache-2.0

License

Write typesafe and typo-safe database migrations, using your existing Slick table definitions.

Pipeline Status

Coverage Status

Maven Central

Dependency

Slick version SBT dependency Supported scala versions
3.4.0 "io.github.nafg.slick-migration-api" %% "slick-migration-api" % "0.9.0" 2.12, 2.13
3.3.3 "io.github.nafg.slick-migration-api" %% "slick-migration-api" % "0.8.2" 2.12, 2.13
3.3.2 "io.github.nafg" %% "slick-migration-api" % "0.8.0" 2.12, 2.13
3.3.0 "io.github.nafg" %% "slick-migration-api" % "0.6.1" 2.11, 2.12
3.2.3 "io.github.nafg" %% "slick-migration-api" % "0.4.4" 2.11, 2.12
3.2.1 "io.github.nafg" %% "slick-migration-api" % "0.4.2" 2.11, 2.12
3.2.0 "io.github.nafg" %% "slick-migration-api" % "0.4.0" 2.11, 2.12
3.1.1 "io.github.nafg" %% "slick-migration-api" % "0.3.0" 2.11
3.0.3 "io.github.nafg" %% "slick-migration-api_slick30" % "0.3.0" 2.10, 2.11
2.1.0 "io.github.nafg" %% "slick-migration-api" % "0.1.1" 2.10

Artifacts are deployed to Maven Central.

Example

import slick.jdbc.H2Profile.api._
import slick.migration.api._

val db = Database.forConfig("example-config")

implicit val dialect: H2Dialect = new H2Dialect

class MyTable(tag: Tag) extends Table[(Int, String)](tag, "my_table") {
  val col1 = column[Int]("col1")
  val col2 = column[String]("col2")
  val index1 = index("idx1", col1)
  def * = (col1, col2)
}
val MyTable = TableQuery[MyTable]
val init =
  TableMigration(MyTable)
    .create
    .addColumns(_.col1, _.col2)
    .addIndexes(_.index1)
    .renameColumn(_.col1, "col3")
val seed =
  SqlMigration("insert into myTable (col1, col2) values (10, 20)")
  
val migration = init & seed

db.run(migration())

Releases

What's Changed

Update sbt-ci-release to 1.11.1 by @scala-steward in #429 Update sbt, scripted-plugin to 1.11.1 by @scala-steward in #430 Go back to the LTS version of Scala 3 by @nafg in #432

Full C...

What's Changed

Update scala3-library to 3.4.1 by @scala-steward in #331 Update scala3-library to 3.4.1 by @nafg-scala-steward in #330 Update slf4j-simple to 2.0.13 by @nafg-scala-steward in #332 Upda...

What's Changed

Update slick, slick-testkit to 3.4.1 by @scala-steward in #209 Update sbt-scoverage to 2.0.3 by @scala-steward in #210 Update slf4j-simple to 2.0.1 by @scala-steward in #211 Update sbt...

v0.10.0-M1

Pre-release

Nov 26, 2023

Download .zip

What's Changed

Update slick, slick-testkit to 3.4.1 by @scala-steward in #209 Update sbt-scoverage to 2.0.3 by @scala-steward in #210 Update slf4j-simple to 2.0.1 by @scala-steward in #211 Update sbt...

Sep 12, 2022

Download .zip

What's Changed

Update sbt-scoverage to 1.7.3 by @scala-steward in #136 Update scala-library to 2.12.15 by @scala-steward in #155 Update scala-library to 2.12.16 by @scala-steward in #190 Update sbt-s...