-
Notifications
You must be signed in to change notification settings - Fork 32
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove hardcoded imports in slick migrations #22
Remove hardcoded imports in slick migrations #22
Conversation
Thanks for the contribution! I'm currently traveling. I will take a look at it as soon as I find some time.
|
import datamodel.v${version - 1}.schema.tables.UsersRow""" | ||
else "" | ||
s"""import ${driverName}.api._ | ||
case DBIO => s"""import ${driverName}.api._ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this would be a good idea, because I think in a Slick migration, the code usually relies on some object of the former version (in this case Users
and UserRow
). Even though users can simply add these imports manually, having these imports in the template can save users quite some trouble, and remind users to always import the predecessor version of the generated code instead of the latest version or one of the other former versions. Therefore, I would like to keep these imports in the template.
However, it is indeed not appropriate to have Users
and UsersRow
in it. What do you think if we use the wildcard import style (i.e. import datamodel.v${version - 1}.schema.tables._
)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely agreed, wildcard imports should work well, I'll modify the code.
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 |
f076f4b
to
ee78566
Compare
Alright, I updated the code to use a wildcard import. I also made it use |
That's awesome! Thanks! |
…-imports Remove hardcoded imports in slick migrations
When adding a new slick migration, the generated code always contains imports for
Users
andUserRow
. This commit removes those hardcoded import statements.