#[non_exhaustive]pub enum TenancyMode {
None,
Row,
Schema,
}Expand description
Tenancy isolation mode for multi-tenant deployments.
Determines how tenant data is separated at the database level.
Configured via [fraiseql.tenancy] in fraiseql.toml.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
None
Single-tenant deployment, no isolation machinery.
Row
Row-level isolation: shared tables with @tenant_id column injection.
The compiler validates that all queries/mutations referencing
@tenant_id-annotated types have inject_params wired correctly.
At runtime, InjectedParamSource::Jwt resolves the tenant claim
and injects a WHERE clause.
Schema
Schema-level isolation: per-tenant PostgreSQL schemas.
Each tenant’s connection pool is established with
search_path = tenant_{key},public (lowered into the PostgreSQL startup
options parameter), so every connection the pool opens carries it —
including ones opened later to grow the pool and replacements created
after a backend disconnects. TenantExecutorFactory provisions the
schema via DDL at registration and verifies the isolation took before
returning an executor.
It is deliberately not a SET search_path statement: that is
session-scoped, so it configures one pooled connection and leaves the
rest resolving against public (#809).
Trait Implementations§
Source§impl Clone for TenancyMode
impl Clone for TenancyMode
impl Copy for TenancyMode
Source§impl Debug for TenancyMode
impl Debug for TenancyMode
Source§impl Default for TenancyMode
impl Default for TenancyMode
Source§impl<'de> Deserialize<'de> for TenancyMode
impl<'de> Deserialize<'de> for TenancyMode
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for TenancyMode
impl Display for TenancyMode
impl Eq for TenancyMode
Source§impl PartialEq for TenancyMode
impl PartialEq for TenancyMode
Source§impl Serialize for TenancyMode
impl Serialize for TenancyMode
impl StructuralPartialEq for TenancyMode
Auto Trait Implementations§
impl Freeze for TenancyMode
impl RefUnwindSafe for TenancyMode
impl Send for TenancyMode
impl Sync for TenancyMode
impl Unpin for TenancyMode
impl UnsafeUnpin for TenancyMode
impl UnwindSafe for TenancyMode
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.