Scala-Forklift helps manage and apply database migrations for your Scala project.
Scala-Forklift helps manage and apply database migrations for your Scala project.
Write your migrations in plain SQL:
MyMigrations.migrations = MyMigrations.migrations :+ SqlMigration(1)(List(
sqlu"""create table "users" ("id" INTEGER NOT NULL PRIMARY KEY,"first" VARCHAR NOT NULL,"last" VARCHAR NOT NULL)"""
))
Or type-safe Slick queries:
MyMigrations.migrations = MyMigrations.migrations :+ DBIOMigration(2)(
DBIO.seq(Users ++= Seq(
UsersRow(1, "Chris","Vogt"),
UsersRow(2, "Yao","Li")
)))
Don't worry about the Scala code for your database schema. Our source code generator will have it generated for you automatically.
Key Features:
Add the following dependency to your build.sbt
:
libraryDependencies += "com.liyaos" %% "scala-forklift-slick" % "0.2.0-BETA"
check example for tutorial and example code.
Alternatively, you can use our start template on GitHub to quickly start a project with Scala-Forklift:
git clone https://github.com/lastland/scala-forklift-start-template.git
reset
command may not correctly handle database schemas with foreign keys.