• Stars
    star
    190
  • Rank 186,680 (Top 4 %)
  • Language
    Scala
  • License
    Other
  • Created over 8 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

Scala-Forklift

Circle CI Join 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 use slick-migration-api:

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

(Note: APIMigration is not supported in versions prior to v0.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 with Slick and slick-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 Version Slick Version SBT dependency
2.11.x 3.1.x libraryDependencies += "com.liyaos" %% "scala-forklift-slick" % "0.2.3"
2.12.x, 2.11.x 3.2.x libraryDependencies += "com.liyaos" %% "scala-forklift-slick" % "0.3.1"
2.13.x, 2.12.x 3.3.x libraryDependencies += "com.liyaos" %% "scala-forklift-slick" % "0.3.2"

For tutorial and example code, please check example.

Here is also a wonderful tutorial 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

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

More Repositories

1

ClairvoyanceMonad

The Coq formalization of the paper Reasoning about the garden of forking paths.
Coq
24
star
2

Tricks-Museum

a collection for interesting code tricks
C
23
star
3

WebSpec

Coq
17
star
4

scala-forklift-quill

A demonstration of using Scala-Forklift to support database migrations on Quill.
Scala
12
star
5

MINIX-3.1.7-Lottery-Scheduler

A patch to implement lottery scheduling policy on MINIX 3.1.7.
11
star
6

ScalaHDL2

The second version of ScalaHDL. Scala style!
Scala
6
star
7

HaskellTheoremProver

A theorem proving framework for intuitionistic and classical propositional logics in Haskell.
Haskell
6
star
8

play-slick-forklift-example

An example of doing database migration using play, play-slick, and scala-forklift.
Scala
6
star
9

DTScala

Dependent Types in Scala
Scala
6
star
10

Network-Assignments

My assignments for Jingyu Zhou's network course.
C++
4
star
11

p

A lite version of Linux ps command
C
3
star
12

rrpostgetter

统计人人网热门日志的常见词语及其出现频率
3
star
13

PTSemForEffects

A Coq formalization of the paper "A Predicate Transformer Semantics for Effects (Functional Pearl)"
Coq
3
star
14

BasketballGym

My assignment for Computer Graphics course
C++
2
star
15

Life-clj

A simple implementation of Conway's Game of Life in Clojure.
Clojure
2
star
16

ClassExchange

PHP
2
star
17

ScalaHDL

Scala
2
star
18

lastland.github.io

Personal web page.
HTML
2
star
19

ImageProcessor

My assignment for Image Process course
C++
2
star
20

AskWord

a simple program to ask me gre words
Scala
1
star
21

my-linux-conf

My Linux configuration files
Shell
1
star
22

mdexe

Markdown can be executed
Python
1
star
23

FPScala

Scala
1
star
24

pl-blog

TeX
1
star
25

99ProblemsScala

my solutions to 99 Scala Problems(http://aperiodic.net/phil/scala/s-99/)
Scala
1
star
26

GitHubRepoCrawler

Scala
1
star
27

CSDI-Papers-Notes

my personal notes for papers read for CSDI course
TeX
1
star
28

FPInPL

A collection of FP concepts in languages other than traditional functional languages.
Scala
1
star
29

scala-forklift-start-template

Start template for Scala-Forklift.
Scala
1
star