You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
First of all. I'd like to say that kanel and kanel-kysely is a great tool with lots of flexibility for type generation, and I'm grateful of the efforts and design put into this awesome project. I'm currently using it in multiple projects in my work. It is great!
I'd like to make a suggestion to include a schemaStyle option with either namespace or multi-tenant values based on the Working with schemas article from Kysely.
In it, it posits two ways of using schemas in postgres:
To group a logical set of tables under the same "namespace". For example all tables directly related to users could live under a user schema.
To have a separate namespaced copy of a set of tables for each tenant in a multitenant application.
For Option 1, Database interface prefixes table names with the schema name, except the public schema. Example:
interfaceDatabase{// these tables are in the `user` schema'user.user': UserTable'user.user_permission': UserPermissionTable'user.permission': PermissionTable// these tables are in the `public` schema, notice that it doesn't prefix with `public.`pet: PetTable}
For Option 2, Database interface prefixes table names with the schema name only in the public schema. This is because in multi-tenant situation, the public schema holds shared tables for all tenants. Example:
interfaceDatabase{// these tables are in non-public schemas and they are not prefixeduser: UserTableuser_permission: UserPermissionTable// These tables are in public schemas and prefixed with `public.`'public.permission': PermissionTable}
The text was updated successfully, but these errors were encountered:
Thank you for the kind words and the contribution!
This seems like an obvious improvement. As I am not using Kysely myself (I expect that I will in the future), I am not certain of what the most correct answers are and I have been relying on the community for this. I am happy to make this change in the library itself (or accept a PR that does).
I agree with you. The two styles I mentioned are from Kysely documentation, but in reality, different use cases will lead to different design decisions. kanel with its preRenderHooks is flexible enough to solve most of my needs. Let's wait for more feedback from Kysely users. This issue is a nice to have, and not urgent ( at least to me ).
First of all. I'd like to say that
kanel
andkanel-kysely
is a great tool with lots of flexibility for type generation, and I'm grateful of the efforts and design put into this awesome project. I'm currently using it in multiple projects in my work. It is great!I'd like to make a suggestion to include a
schemaStyle
option with eithernamespace
ormulti-tenant
values based on the Working with schemas article from Kysely.In it, it posits two ways of using schemas in postgres:
For Option 1,
Database
interface prefixes table names with the schema name, except thepublic
schema. Example:For Option 2,
Database
interface prefixes table names with the schema name only in thepublic
schema. This is because in multi-tenant situation, thepublic
schema holds shared tables for all tenants. Example:The text was updated successfully, but these errors were encountered: