ash_postgres v0.26.2 AshPostgres.DataLayer.ManageTenant View Source
Configuration for the behavior of a resource that manages a tenant
Options
:template
- Required. A template that will cause the resource to create/manage the specified schema.
Use this if you have a resource that, when created, it should create a new tenant
for you. For example, if you have a customer
resource, and you want to create
a schema for each customer based on their id, e.g customer_10
set this option
to ["customer_", :id]
. Then, when this is created, it will create a schema called
["customer_", :id]
, and run your tenant migrations on it. Then, if you were to change
that customer's id to 20
, it would rename the schema to customer_20
. Generally speaking
you should avoid changing the tenant id.
:create?
- Whether or not to automatically create a tenant when a record is created The default value istrue
.:update?
- Whether or not to automatically update the tenant name if the record is udpated The default value istrue
.
Link to this section Summary
Functions
Configuration for the behavior of a resource that manages a tenant
Link to this section Functions
Configuration for the behavior of a resource that manages a tenant
Options
:template
- Required. A template that will cause the resource to create/manage the specified schema.
Use this if you have a resource that, when created, it should create a new tenant
for you. For example, if you have a customer
resource, and you want to create
a schema for each customer based on their id, e.g customer_10
set this option
to ["customer_", :id]
. Then, when this is created, it will create a schema called
["customer_", :id]
, and run your tenant migrations on it. Then, if you were to change
that customer's id to 20
, it would rename the schema to customer_20
. Generally speaking
you should avoid changing the tenant id.
:create?
- Whether or not to automatically create a tenant when a record is created The default value istrue
.:update?
- Whether or not to automatically update the tenant name if the record is udpated The default value istrue
.