mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 13:33:50 +12:00
32 lines
638 B
Elixir
32 lines
638 B
Elixir
defmodule AshPostgres.MultitenancyTest.Post do
|
|
@moduledoc false
|
|
use Ash.Resource,
|
|
data_layer: AshPostgres.DataLayer
|
|
|
|
attributes do
|
|
uuid_primary_key(:id, writable?: true)
|
|
attribute(:name, :string)
|
|
end
|
|
|
|
actions do
|
|
create(:create)
|
|
read(:read)
|
|
update(:update)
|
|
destroy(:destroy)
|
|
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)
|
|
end
|
|
|
|
relationships do
|
|
belongs_to(:org, AshPostgres.MultitenancyTest.Org)
|
|
end
|
|
end
|