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
Hello SeaORM team, first of all thank you for the project, it has been a great experience so far.
This is a duplicate of discussions/2117 with more elaboration. I would like to request support for dynamic schema selection at query time, without baking the schema name into entity definitions.
My setup
I am building a multi-tenant system using PostgreSQL with a schema-per-tenant architecture:
Each user account gets its own PostgreSQL schema created at runtime (e.g. tenant_12345)
All schemas share the exact same structure
The number of schemas is dynamic and unbounded
Strong tenant isolation is required
From an application perspective:
The database connection always points to the same database
The schema is determined per request / per user
The same set of entities should operate on different schemas
Current limitation
Currently, SeaORM models the schema as part of the entity definition:
#[sea_orm(schema_name = "tenant_1")]
This makes dynamic schemas difficult because:
Schema names must be known at compile time
Entities must be duplicated per schema
Using SET search_path is unsafe with connection pooling
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hello SeaORM team, first of all thank you for the project, it has been a great experience so far.
This is a duplicate of discussions/2117 with more elaboration. I would like to request support for dynamic schema selection at query time, without baking the schema name into entity definitions.
My setup
I am building a multi-tenant system using PostgreSQL with a schema-per-tenant architecture:
tenant_12345)From an application perspective:
Current limitation
Currently, SeaORM models the schema as part of the entity definition:
#[sea_orm(schema_name = "tenant_1")]This makes dynamic schemas difficult because:
SET search_pathis unsafe with connection poolingRequested feature
I would like to be able to:
or:
Use the same entity definitions regardless of schema name.
Optionally enforce schema specification, e.g.:
So that:
Thank you for considering this feature.
Beta Was this translation helpful? Give feedback.
All reactions