RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.
MIT License
773 stars 69 forks source link

Support for multiple unqualified schemas #155

Closed RobinClowers closed 1 month ago

RobinClowers commented 4 months ago

The project I use Kysely with has two main schemas, and objects are promoted from one to the other from time to time. Currently to support both versions, we have to add conditionals to our code to swap the fully qualified names based on version information from our backend system. Since our backend guarantees that names are unique across these two schemas, we could set our search path to contain both, and just reference the relations by unqualified name.

I see there is already some precedent for this with https://github.com/RobinBlomberg/kysely-codegen/pull/56. I'm curious what you think about take this further to accept multiple schemas? The obvious thing would be allow the flag to be specified multiple times, but I'm open to a more explicit api.

Upvote & Fund

Fund with Polar

RobinClowers commented 4 months ago

@RobinBlomberg any chance I can get your eyes on this? I'd like to start this work soon, and I would feel a lot better about it if you were onboard with the general idea, even if we still need to iron out the details a bit.

RobinClowers commented 3 months ago

FYI I'm planning to implement this and open a PR, though I may not get to it for a few weeks.