Skip to content
slick-codegen compile hook for sbt
Scala
Branch: master
Clone or download
Latest commit 4f667ff Jun 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
project Updated sbt version Feb 26, 2019
src Update slick 3.3.2 Jun 16, 2019
.gitignore init Apr 8, 2015
.travis.yml use xenial and openjdk Jun 16, 2019
README.md v1.4.0 Feb 26, 2019
build.sbt Update slick 3.3.2 Jun 16, 2019

README.md

sbt-slick-codegen

travis-ci

slick-codegen compile hook for sbt

Install

Slick version slick-codegen version sbt version
3.3.x 1.4.0 1.x
3.2.x 1.3.0 1.x
3.1.x 1.2.1 0.13.x
3.0.x 1.1.1 0.13.x
// plugins.sbt

addSbtPlugin("com.github.tototoshi" % "sbt-slick-codegen" % slickCodegenVersion)

// Database driver
// For example, when you are using PostgreSQL
libraryDependencies += "org.postgresql" % "postgresql" % "9.4-1201-jdbc41"

Configuration

// build.sbt
import slick.codegen.SourceCodeGenerator
import slick.{ model => m }

// required
slickCodegenSettings

// required
// Register codegen hook
sourceGenerators in Compile <+= slickCodegen

// required
slickCodegenDatabaseUrl := "jdbc:postgresql://localhost/example"

// required
slickCodegenDatabaseUser := "dbuser"

// required
slickCodegenDatabasePassword := "dbpassword"

// required (If not set, postgresql driver is choosen)
slickCodegenDriver := slick.driver.PostgresDriver

// required (If not set, postgresql driver is choosen)
slickCodegenJdbcDriver := "org.postgresql.Driver"

// optional but maybe you want
slickCodegenOutputPackage := "com.example.models"

// optional, pass your own custom source code generator
slickCodegenCodeGenerator := { (model: m.Model) => new SourceCodeGenerator(model) }

// optional
// For example of all the tables in a database we only would like to take table named "users"
slickCodegenIncludedTables in Compile := Seq("users")

// optional
// For example, to exclude flyway's schema_version table from the target of codegen. This still applies after slickCodegenIncludedTables.
slickCodegenExcludedTables in Compile := Seq("schema_version")

//optional
slickCodegenOutputDir := (sourceManaged in Compile).value

Example

https://github.com/tototoshi/sbt-slick-codegen-example

License

Apache 2.0

You can’t perform that action at this time.