ExTenant.Schema (ExTenant v0.1.4) View Source
## to use the Extenant.Schema in your schema modules follow this example
- it injects the belongs_to relationship to the tenant
- it also raises a compiler error if the
tenanted()call was omitted - it works with the
tenant_idfield set in Config.exs
defmodule Post do
use ExTenant.Schema
import Ecto.Changeset
tenanted_schema "posts" do
field(:name, :string)
field(:body, :string)
tenanted()
endend ...
Link to this section Summary
Functions
injects belongs_to relationship to the tenant model see this example
Replaces Ecto.Schema.embedded_schema/2 - checking whether tenanted() has been
called - that injects the belongs_to tenant relationship
Replaces Ecto.Schema.schema/2 - checking whether tenanted() has been
called - that injects the belongs_to tenant relationship
Link to this section Functions
injects belongs_to relationship to the tenant model see this example
tenanted_schema "posts" do
field(:name, :string)
tenanted()end
Replaces Ecto.Schema.embedded_schema/2 - checking whether tenanted() has been
called - that injects the belongs_to tenant relationship
Replaces Ecto.Schema.schema/2 - checking whether tenanted() has been
called - that injects the belongs_to tenant relationship