docs: update docs

This commit is contained in:
Zach Daniel 2021-01-05 12:51:22 -05:00
parent 985e928340
commit ec08e0131f

View file

@ -19,10 +19,16 @@ defmodule MyApp.Organization do
use Ash.Resource, use Ash.Resource,
... ...
manage_tenant do postgres do
template ["org_", :id] ...
manage_tenant do
template ["org_", :id]
end
end end
end end
``` ```
With this configuration, if you create an organization, it will create a corresponding schema, e.g. `org_10` in the database. Then it will run your tenant migrations on that schema. To override the tenant_migrations path, implement the `c:AshPostgres.Repo.tenant_migrations_path/0` callback. With this configuration, if you create an organization, it will create a corresponding schema, e.g. `org_10` in the database. Then it will run your tenant migrations on that schema. To override the tenant_migrations path, implement the `c:AshPostgres.Repo.tenant_migrations_path/0` callback.
Notice that `manage_tenant` is nested inside the `postgres` block. This is because the method of managing tenants is specific to postgres, and if another data layer supported multitenancy they may or may not support managing tenants in the same way.