• Stars
    star
    187
  • Rank 202,949 (Top 5 %)
  • Language
    Scala
  • License
    Other
  • Created almost 9 years ago
  • Updated almost 2 years 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
24
star
3

WebSpec

Coq
18
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

HaskellTheoremProver

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

ScalaHDL2

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

DTScala

Dependent Types in Scala
Scala
6
star
9

play-slick-forklift-example

An example of doing database migration using play, play-slick, and scala-forklift.
Scala
5
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

ScalaHDL

Scala
3
star
14

PTSemForEffects

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

BasketballGym

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

Life-clj

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

my-notes

my notes on books, courses, and others.
CSS
2
star
18

ClassExchange

PHP
2
star
19

ImageProcessor

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

lastland.github.io

Personal web page.
HTML
2
star
21

AskWord

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

scala-forklift-start-template

Start template for Scala-Forklift.
Scala
1
star
23

mdexe

Markdown can be executed
Python
1
star
24

FPScala

Scala
1
star
25

pl-blog

TeX
1
star
26

99ProblemsScala

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

my-linux-conf

My Linux configuration files
Shell
1
star
28

ProgramAdverbs

The Coq formalization of the paper Program Adverbs and Tlön Embeddings by Yao Li and Stephanie Weirich, published at ICFP 2022.
Coq
1
star
29

GitHubRepoCrawler

Scala
1
star
30

CSDI-Papers-Notes

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

FPInPL

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

generic-vale

Makefile
1
star