Hi,
I have the following generator:
// remember to give the project a github star if you like it <3
//
//> using dep "com.olvind.typo::typo:0.6.0"
//> using scala "3.3.0"
import typo.*
// adapt to your instance and credentials
implicit val c: java.sql.Connection =
java.sql.DriverManager.getConnection("jdbc:postgresql://localhost:5432/somedb?user=postgres&password=password")
val options = Options(
// customize package name for generated code
pkg = "typo.models",
// pick your database library
dbLib = Some(DbLibName.Anorm),
jsonLibs = List(JsonLibName.PlayJson),
// many more possibilities for customization here
// ...
)
// current folder, where you run the script from
val location = java.nio.file.Path.of(sys.props("user.dir"))
// destination folder. All files in this dir will be overwritten!
val targetDir = location.resolve("app")
// where Typo will look for sql files
val scriptsFolder = location.resolve("sql")
// you can use this to customize which relations you want to generate code for, see below
val selector = Selector.ExcludePostgresInternal
generateFromDb(options, folder = targetDir, selector = selector, scriptsPaths = List(scriptsFolder))
.overwriteFolder()
// add changed files to git, so you can keep them under control
//scala.sys.process.Process(List("git", "add", targetDir.toString)).!!
I have a play framework project and I want to place the generated code in a package under app. As is, the generator wiped out the content of the app folder (it included the controllers code and others) which was somewhat unexpected. I thought the generator would remove the typo folder recursively. Luckily, I use IntelliJ and I was able to restore the deleted code. It is a brand new project and I didn't add the code yet to git until now after this accident.
Are there any options that allow me to tell the generator not to wipe out the content of the app folder, i.e. the content of targetDir?
For now, I am going to add the generated code somewhere under: target/scala-3.3.1\typo.
Thanks
Hi,
I have the following generator:
I have a play framework project and I want to place the generated code in a package under app. As is, the generator wiped out the content of the app folder (it included the controllers code and others) which was somewhat unexpected. I thought the generator would remove the
typofolder recursively. Luckily, I use IntelliJ and I was able to restore the deleted code. It is a brand new project and I didn't add the code yet to git until now after this accident.Are there any options that allow me to tell the generator not to wipe out the content of the app folder, i.e. the content of targetDir?
For now, I am going to add the generated code somewhere under: target/scala-3.3.1\typo.
Thanks