Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Type-safe data migration tool for Slick, Git and beyond.

License

NotificationsYou must be signed in to change notification settings

lastland/scala-forklift

Repository files navigation

Circle CIJoin the chat at https://gitter.im/lastland/scala-forklift

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")  )))

Or useslick-migration-api:

MyMigrations.migrations=MyMigrations.migrations:+APIMigration(3)(TableMigration(Users).    renameColumn(_.first,"firstname").    renameColumn(_.last,"lastname"))

(Note:APIMigration is not supported in versions prior tov0.2.3)

Don't worry about keeping the Scala code and your database schema consistent. Our source code generator will have it generated for you.

Key Features:

  • Supports for type-safe database migration withSlick andslick-migration-api.
  • A source code generator to generate and manage Scala models from your database schemas.
  • A tool to help you manage your dev db with git, with supports for branching and merging.
  • High customizability.

How to Use

Scala-Forklift supports both Slick 3.1 and Slick 3.2. The latest versions of Scala-Forklift are given below:

Scala VersionSlick VersionSBT dependency
2.11.x3.1.xlibraryDependencies += "com.liyaos" %% "scala-forklift-slick" % "0.2.3"
2.12.x, 2.11.x3.2.xlibraryDependencies += "com.liyaos" %% "scala-forklift-slick" % "0.3.1"
2.13.x, 2.12.x3.3.xlibraryDependencies += "com.liyaos" %% "scala-forklift-slick" % "0.3.2"

For tutorial and example code, please checkexample.

Here is also a wonderfultutorial written by Andreas Burkard and Julian Tragé.

Quick Start

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

More Examples

Known Issues

  • Thereset command may not correctly handle database schemas with foreign keys.

About

Type-safe data migration tool for Slick, Git and beyond.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp