volatiletech / sqlboiler

Generate a Go ORM tailored to your database schema.
BSD 3-Clause "New" or "Revised" License
6.66k stars 539 forks source link

Add support for other schemas not just 'public' #31

Closed ajankovic closed 7 years ago

ajankovic commented 8 years ago

Maybe I am wrong but currently there is only support for 'public' schema, right?

It would be nice to probably add a configuration option for specifying other schemas as well.

nullbio commented 8 years ago

That's correct. Did you want this configuration flag to replace 'public' as a single schema, or did you want it to provide a list of schemas?

ajankovic commented 8 years ago

I guess single schema is fine. But if you think list will cover more use cases I don't mind.

nullbio commented 8 years ago

Due to the fact that different schemas can contain tables with the same names, we've decided to only support replacing 'public', instead of a list of schemas. Otherwise, you will get naming conflicts for all of the generated models and functions, and the only way around that would be to prefix everything with the schema name, which is quite gross. So instead, if you need to generate for multiple schemas, you can just generate multiple different packages, which allows you to organize things however you like. Much cleaner. Will get working on this.

nullbio commented 7 years ago

Hi @ajankovic -- we've released V2 which includes the schema flag requested. See here for release notes: https://github.com/vattle/sqlboiler/releases/tag/v2.0.0

Thanks.