kristiandupont / kanel

Generate Typescript types from Postgres
https://kristiandupont.github.io/kanel/
MIT License
829 stars 57 forks source link

Fix for "duplicate identifier" via generateIndexFile hook for multiple schemas #558

Open simian-loco opened 1 month ago

simian-loco commented 1 month ago

Instead of a global models/index.ts, when using schemas, add models/schema/index.ts index files for preventing typescript "duplicate identifier" errors when schemas contain overlapping resources (e.g. postgrest, supabase, other api-based-schema paradigms).

sweep-ai[bot] commented 1 month ago

Sweep: PR Review

Sweep is currently reviewing your pr...

kristiandupont commented 1 month ago

Thank you for contributing! I do not have time to look at your branch today but I will get around to it this week and merge or suggest changes!

kristiandupont commented 1 month ago

Sorry, that took a bit longer than I anticipated. So forgive me if I am misunderstanding, but it seems that this will always change the output in that there will always be at least one schema. If that's the case then I think this should be an option instead of the default. Or perhaps the old style should be an option, I am not sure..