ash_postgres/test/support/multitenancy/resources/post.ex

33 lines
613 B
Elixir
Raw Normal View History

2020-10-29 15:26:45 +13:00
defmodule AshPostgres.MultitenancyTest.Post do
@moduledoc false
use Ash.Resource,
data_layer: AshPostgres.DataLayer
attributes do
uuid_primary_key :id
attribute :name, :string
2020-10-29 15:26:45 +13:00
end
actions do
create :create
read :read
update :update
destroy :destroy
2020-10-29 15:26:45 +13:00
end
postgres do
table "multitenant_posts"
repo AshPostgres.TestRepo
end
multitenancy do
# Tells the resource to use the data layer
# multitenancy, in this case separate postgres schemas
strategy :context
2020-10-29 15:26:45 +13:00
end
relationships do
belongs_to :org, AshPostgres.MultitenancyTest.Org
2020-10-29 15:26:45 +13:00
end
end