RobinBlomberg / kysely-codegen

Generate Kysely type definitions from your database.
MIT License
819 stars 73 forks source link

Add schema to the generated types #219

Closed gislerro closed 3 weeks ago

gislerro commented 3 weeks ago

I have multiple schemas A and B that both have a table named foo. Introspecting the database with kysely-codegen generates two interfaces of the same name:

export interface Foo {
   id: Generated<string>;
   im_in_a: string
}
export interface Foo {
  id: Generated<string>;
  im_in_b: string
}
export interface DB {
   foo: Foo,
   foo: Foo
}

Ideally codegen would respect the schema of the tables (kysely docs):

export interface DB {
  "A.foo": AFoo,
  "B.foo": BFoo
}

this functionality is somewhat related to #211

Upvote & Fund

Fund with Polar

gislerro commented 3 weeks ago

I just realised after looking at the source that I shouldn't specify --schema A --schema B in the cli to get what I need... 😅

RobinBlomberg commented 3 weeks ago

Great that you solved it! The next version will coincidentally rename --schema to --default-schema for extra clarity. 👍