mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-20 21:43:12 +12:00
30 lines
557 B
Elixir
30 lines
557 B
Elixir
defmodule AshPostgres.MultitenancyTest.Post do
|
|
@moduledoc false
|
|
use Ash.Resource,
|
|
data_layer: AshPostgres.DataLayer
|
|
|
|
attributes do
|
|
attribute(:id, :uuid, primary_key?: true, default: &Ash.uuid/0)
|
|
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
|
|
strategy(:context)
|
|
end
|
|
|
|
relationships do
|
|
belongs_to(:org, AshPostgres.MultitenancyTest.Org)
|
|
end
|
|
end
|