Closed krivachy closed 8 years ago
Yes. It is possible, but probably not very convenient in current version.
You can override the SourceCodeGenerator
by overriding https://github.com/lastland/scala-forklift/blob/develop/migrations/slick/src/main/scala/Codegen.scala#L24-L64. You can find Forklift is overriding SourceCodeGenerator
in L43. The starting template offers a place to override the code generator (https://github.com/lastland/scala-forklift-start-template/blob/master/migrations/src/main/scala/Codegen.scala).
Unfortunately, when overriding this method, you need to copy a bunch of code from the original method which is not related to SourceCodeGenerator
.
I'm gonna refactor this part tonight to make it more modular, and publish the changes in 0.2.2-SNAPSHOT
. You can probably wait a little bit if you don't mind using the SNAPSHOT version? Will keep you updated in this thread.
Cool! Yes, I see I could have overridden it, sorry should have looked around a bit more.
Don't worry. Good use case. It makes me realize that this part of code is not so convenient to override. :smiley:
Hi, I have just published 0.2.2-SNAPSHOT. In the latest version you can simply override the getGenerator
method to get what you want. See: https://github.com/lastland/scala-forklift/blob/develop/migrations/slick/src/main/scala/Codegen.scala#L33-L46
Of course the old method of overriding genCode
still works.
Thanks, I'll give it a go!
I would like to use Joda DateTimes in the Slick generated models. It supports this via overriding the
SourceCodeGenerator
, here's an example: https://github.com/tminglei/slick-pg/blob/master/examples/codegen-customization/codegen/src/main/scala/demo/CustomizedCodeGenerator.scala#L43Is it possible to override/configure this?