From 8e303beb5d40a8e3ad5177382c8872bec147d48f Mon Sep 17 00:00:00 2001 From: Zach Daniel Date: Sat, 27 Jun 2020 15:11:28 -0400 Subject: [PATCH] feat: update to latest ash --- lib/ash_postgres.ex | 4 ++-- lib/data_layer.ex | 11 +---------- lib/repo.ex | 6 +----- mix.exs | 2 +- mix.lock | 4 ++-- 5 files changed, 7 insertions(+), 20 deletions(-) diff --git a/lib/ash_postgres.ex b/lib/ash_postgres.ex index 1a2923a..fa94257 100644 --- a/lib/ash_postgres.ex +++ b/lib/ash_postgres.ex @@ -11,11 +11,11 @@ defmodule AshPostgres do @doc "Fetch the configured repo for a resource" def repo(resource) do - Extension.get_opt(resource, [:postgres], :repo) + Extension.get_opt(resource, [:postgres], :repo, nil, true) end @doc "Fetch the configured table for a resource" def table(resource) do - Extension.get_opt(resource, [:postgres], :table) + Extension.get_opt(resource, [:postgres], :table, nil, true) end end diff --git a/lib/data_layer.ex b/lib/data_layer.ex index 8fa0d7c..7474e73 100644 --- a/lib/data_layer.ex +++ b/lib/data_layer.ex @@ -85,11 +85,6 @@ defmodule AshPostgres.DataLayer do {:ok, from(row in query, offset: ^offset)} end - @impl true - def run_query(%{__impossible__: true}, _) do - {:ok, []} - end - @impl true def run_query(query, resource) do {:ok, repo(resource).all(query)} @@ -528,10 +523,6 @@ defmodule AshPostgres.DataLayer do end defp maybe_get_resource_query(resource) do - if Ash.resource_module?(resource) do - {table(resource), resource} - else - resource - end + {table(resource), resource} end end diff --git a/lib/repo.ex b/lib/repo.ex index d3d1d15..537caf2 100644 --- a/lib/repo.ex +++ b/lib/repo.ex @@ -18,16 +18,12 @@ defmodule AshPostgres.Repo do [] end - def init(:supervisor, config) do + def init(_, config) do new_config = Keyword.put(config, :installed_extensions, installed_extensions()) {:ok, new_config} end - def init(:runtime, config) do - init(:supervisor, config) - end - defoverridable installed_extensions: 0 end end diff --git a/mix.exs b/mix.exs index 93603c0..6e4f56e 100644 --- a/mix.exs +++ b/mix.exs @@ -61,7 +61,7 @@ defmodule AshPostgres.MixProject do [ {:ecto_sql, "~> 3.4"}, {:postgrex, ">= 0.0.0"}, - {:ash, "~> 0.6.0"}, + {:ash, "0.7.0"}, {:git_ops, "~> 2.0.0", only: :dev}, {:ex_doc, "~> 0.22", only: :dev, runtime: false}, {:ex_check, "~> 0.11.0", only: :dev}, diff --git a/mix.lock b/mix.lock index cacbb98..a3fe932 100644 --- a/mix.lock +++ b/mix.lock @@ -1,5 +1,5 @@ %{ - "ash": {:hex, :ash, "0.6.0", "cb9fdcfcc132bb052d9daa1b35233740158e61c455acf3928f0e8d84c1548013", [:mix], [{:ecto, "~> 3.4", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8.0", [hex: :ets, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.2.1", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.1.4", [hex: :picosat_elixir, repo: "hexpm", optional: false]}], "hexpm", "e0539bb35446a713fc8b37653ba33eb5781a9f4e0466a69854315b3cd2f6bd61"}, + "ash": {:hex, :ash, "0.7.0", "b628ddd8b5afdd8a9985a5a4d9e31cf7cae2ba424cefde969630fb0f67175ba3", [:mix], [{:ecto, "~> 3.4", [hex: :ecto, repo: "hexpm", optional: false]}, {:ets, "~> 0.8.0", [hex: :ets, repo: "hexpm", optional: false]}, {:nimble_options, "~> 0.2.1", [hex: :nimble_options, repo: "hexpm", optional: false]}, {:picosat_elixir, "~> 0.1.4", [hex: :picosat_elixir, repo: "hexpm", optional: false]}], "hexpm", "33047767515e11a03b0fd26b581b85f1814ac51618b96581d0d605c2c0c4f706"}, "bunt": {:hex, :bunt, "0.2.0", "951c6e801e8b1d2cbe58ebbd3e616a869061ddadcc4863d0a2182541acae9a38", [:mix], [], "hexpm", "7af5c7e09fe1d40f76c8e4f9dd2be7cebd83909f31fee7cd0e9eadc567da8353"}, "certifi": {:hex, :certifi, "2.5.2", "b7cfeae9d2ed395695dd8201c57a2d019c0c43ecaf8b8bcb9320b40d6662f340", [:rebar3], [{:parse_trans, "~>3.3", [hex: :parse_trans, repo: "hexpm", optional: false]}], "hexpm", "3b3b5f36493004ac3455966991eaf6e768ce9884693d9968055aeeeb1e575040"}, "connection": {:hex, :connection, "1.0.4", "a1cae72211f0eef17705aaededacac3eb30e6625b04a6117c1b2db6ace7d5976", [:mix], [], "hexpm", "4a0850c9be22a43af9920a71ab17c051f5f7d45c209e40269a1938832510e4d9"}, @@ -37,6 +37,6 @@ "postgrex": {:hex, :postgrex, "0.15.5", "aec40306a622d459b01bff890fa42f1430dac61593b122754144ad9033a2152f", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:db_connection, "~> 2.1", [hex: :db_connection, repo: "hexpm", optional: false]}, {:decimal, "~> 1.5", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}], "hexpm", "ed90c81e1525f65a2ba2279dbcebf030d6d13328daa2f8088b9661eb9143af7f"}, "sobelow": {:hex, :sobelow, "0.10.2", "00e91208046d3b434f9f08779fe0ca7c6d6595b7fa33b289e792dffa6dde8081", [:mix], [], "hexpm", "e30fc994330cf6f485c1c4f2fb7c4b2d403557d0e101c6e5329fd17a58e55a7e"}, "ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.6", "cf344f5692c82d2cd7554f5ec8fd961548d4fd09e7d22f5b62482e5aeaebd4b0", [:make, :mix, :rebar3], [], "hexpm", "bdb0d2471f453c88ff3908e7686f86f9be327d065cc1ec16fa4540197ea04680"}, - "telemetry": {:hex, :telemetry, "0.4.1", "ae2718484892448a24470e6aa341bc847c3277bfb8d4e9289f7474d752c09c7f", [:rebar3], [], "hexpm", "4738382e36a0a9a2b6e25d67c960e40e1a2c95560b9f936d8e29de8cd858480f"}, + "telemetry": {:hex, :telemetry, "0.4.2", "2808c992455e08d6177322f14d3bdb6b625fbcfd233a73505870d8738a2f4599", [:rebar3], [], "hexpm", "2d1419bd9dda6a206d7b5852179511722e2b18812310d304620c7bd92a13fcef"}, "unicode_util_compat": {:hex, :unicode_util_compat, "0.5.0", "8516502659002cec19e244ebd90d312183064be95025a319a6c7e89f4bccd65b", [:rebar3], [], "hexpm", "d48d002e15f5cc105a696cf2f1bbb3fc72b4b770a184d8420c8db20da2674b38"}, }