-
-
Notifications
You must be signed in to change notification settings - Fork 496
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
Improve AbstractNamingStrategy to get access to table schema #5084
Comments
Not sure I follow here, entity generator already supports multiple schemas and will generate entities from all accessible schemas in postgres. The method that looks for existing tables is using this SQL, which is not limited to a specific schema (it only ignores some system schemas and those you specify in the config. Here is an example from the tests, the
In fact, this is already supported, its just not configurable on the entity generator level, its in the |
Reading this again, I guess I understand what you mean now. The |
@B4nan I was looking at your commit. This is awesome man, highly appreciated 🚀 ! |
Is your feature request related to a problem? Please describe.
Yes, currently there's no way to generate entities for tables with the same name but belonging to different schemas. In Postgres you can create schemas and a table a can exist in 2 different schemas but if you try to generate entities for all the tables in your database you'll get name collisions
Describe the solution you'd like
I noticed there's this naming strategy thing I can use to generate names prefixed by schema that way entities will truly be unique
Describe alternatives you've considered
I considered having a map and running entities generate for different entities and storing the resulting files in different directories. but that's not ideal I think a more scalable solution is to support entities generation names to be made according the schema they belong
Another alternative is to add a new option
skipSchemas
to theentityGenerator.generate()
method to later generate the schema separately but with a class prefix. similar to theskipTables
orskipColumns
that already exist (not ideal tho)The text was updated successfully, but these errors were encountered: