Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Slick Auto-generating DDL
- // Slick allows to use a Stand-Alone generator, or integrate DDL-generating phase into alive project
- // Here we'll write a Stand-Alone generator
- // Create sbt project with the following settings:
- // build.sbt:
- name := "slick-gen"
- version := "1.0.0"
- scalaVersion := "2.12.6"
- libraryDependencies += "com.typesafe.slick" %% "slick-codegen" % "3.2.0"
- libraryDependencies += "mysql" % "mysql-connector-java" % "5.1.39" // change this line to your DBMS driver!
- // project/assembly.sbt:
- addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.7") // to generate FAT jar
- // Main.scala:
- object Main extends App {
- if (args.length != 7) println("Please specify 7 parameters:\n\nprofile - Fully qualified name of the profile class, e.g. “slick.jdbc.MySQLProfile”\njdbcDriver - Fully qualified name of the JDBC driver class, e.g. “com.mysql.jdbc.Driver”\nurl - JDBC url, e.g. “jdbc:mysql://localhost/test?useSSL=false”\noutputFolder - Place where the package folder structure should be put\npkg - Scala package the generated code should be places in\nuser - database connection user name\npassword - database connection password")
- else SourceCodeGenerator.main(args)
- }
- // run "sbt assembly" to build a fat jar
- // usage:
- java -jar slick-gen-assembly-1.0.0.jar slick.jdbc.MySQLProfile com.mysql.jdbc.Driver "jdbc:mysql://localhost/mydb?useSSL=false" /Users/mitrakov/out/ dao root 1234
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement