lastland / scala-forklift

Type-safe data migration tool for Slick, Git and beyond.
Other
188 stars 31 forks source link

Remove hardcoded imports in slick migrations #22

Closed kshepard closed 8 years ago

kshepard commented 8 years ago

When adding a new slick migration, the generated code always contains imports for Users and UserRow. This commit removes those hardcoded import statements.

lastland commented 8 years ago

Thanks for the contribution! I'm currently traveling. I will take a look at it as soon as I find some time.

On Aug 3, 2016, at 1:25 AM, Kenny Shepard notifications@github.com wrote:

When adding a new slick migration, the generated code always contains imports for Users and UserRow. This commit removes those hardcoded import statements.

Note: I have not run the unit tests, but if they for some reason rely on these hardcoded imports, they would also need to be adjusted.

You can view, comment on, or merge this pull request online at:

https://github.com/lastland/scala-forklift/pull/22

Commit Summary

Remove hardcoded imports in slick migrations File Changes

M migrations/slick/src/main/scala/Commands.scala (9) Patch Links:

https://github.com/lastland/scala-forklift/pull/22.patch https://github.com/lastland/scala-forklift/pull/22.diff — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

lastland commented 8 years ago

This also reminds me that I may need to add some tests to this and similar cases. Probably gonna add a subproject-style test and use replace to modify the content in the generated migration file. I will work on this maybe a few days later. In the meantime, you are welcome if you want to add some tests for this pull request.

kshepard commented 8 years ago

Alright, I updated the code to use a wildcard import. I also made it use pkgName for constructing the import, since that is what defines the package name and may be overridden. Unfortunately I'm not going to have time to write tests for this at the moment, but I tested it manually and it works.

lastland commented 8 years ago

That's awesome! Thanks!