mirror of
https://github.com/ash-project/ash_postgres.git
synced 2024-09-19 21:13:19 +12:00
chore: remove repo.to_tenant
This commit is contained in:
parent
ba44af7073
commit
746d396a3c
2 changed files with 10 additions and 11 deletions
|
@ -725,9 +725,9 @@ defmodule AshPostgres.DataLayer do
|
||||||
|> add_timeout(timeout)
|
|> add_timeout(timeout)
|
||||||
end
|
end
|
||||||
|
|
||||||
defp repo_opts(repo, timeout, tenant, resource) do
|
defp repo_opts(_repo, timeout, tenant, resource) do
|
||||||
if Ash.Resource.Info.multitenancy_strategy(resource) == :context do
|
if Ash.Resource.Info.multitenancy_strategy(resource) == :context do
|
||||||
[prefix: repo.tenant_to_schema(tenant)]
|
[prefix: tenant]
|
||||||
else
|
else
|
||||||
if schema = AshPostgres.DataLayer.Info.schema(resource) do
|
if schema = AshPostgres.DataLayer.Info.schema(resource) do
|
||||||
[prefix: schema]
|
[prefix: schema]
|
||||||
|
@ -1385,20 +1385,16 @@ defmodule AshPostgres.DataLayer do
|
||||||
%{
|
%{
|
||||||
data_layer_query
|
data_layer_query
|
||||||
| prefix:
|
| prefix:
|
||||||
repo.tenant_to_schema(
|
query_tenant || AshPostgres.DataLayer.Info.schema(resource) ||
|
||||||
query_tenant || AshPostgres.DataLayer.Info.schema(resource) ||
|
config[:default_prefix] ||
|
||||||
config[:default_prefix] ||
|
"public"
|
||||||
"public"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
%{
|
%{
|
||||||
data_layer_query
|
data_layer_query
|
||||||
| prefix:
|
| prefix:
|
||||||
repo.tenant_to_schema(
|
AshPostgres.DataLayer.Info.schema(resource) || config[:default_prefix] ||
|
||||||
AshPostgres.DataLayer.Info.schema(resource) || config[:default_prefix] ||
|
"public"
|
||||||
"public"
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -171,8 +171,11 @@ defmodule AshPostgres.Test.Post do
|
||||||
end
|
end
|
||||||
|
|
||||||
code_interface do
|
code_interface do
|
||||||
|
define(:create, args: [:title])
|
||||||
define(:get_by_id, action: :read, get_by: [:id])
|
define(:get_by_id, action: :read, get_by: [:id])
|
||||||
define(:increment_score, args: [{:optional, :amount}])
|
define(:increment_score, args: [{:optional, :amount}])
|
||||||
|
define(:destroy)
|
||||||
|
define(:bulk_create, bulk?: true, action: :create)
|
||||||
end
|
end
|
||||||
|
|
||||||
relationships do
|
relationships do
|
||||||
|
|
Loading…
Reference in a new issue