Commit graph

908 commits

Author SHA1 Message Date
Barnabas Jovanovics
e2ee0016ea
test: add test that reproduces dependent select problem (#136) 2023-03-31 12:12:13 -04:00
Zach Daniel
124e29c1ad chore: release version v1.3.18 2023-03-23 17:20:56 -04:00
Zach Daniel
422281bde6 chore: update mix.lock 2023-03-23 17:19:58 -04:00
Zach Daniel
9faf783c54 chore: unlock spark dependency 2023-03-23 17:19:45 -04:00
Zach Daniel
54150b20ca chore: small improvement inspect/errors on ecto changeset 2023-03-20 16:11:05 -04:00
Zach Daniel
ae881a4ce5 chore: release version v1.3.17 2023-03-20 12:17:52 -04:00
Zach Daniel
5046273ed0 fix: properly map parent bindings in exists 2023-03-17 17:06:06 -04:00
Zach Daniel
bf9fbf682c chore: release version v1.3.16 2023-03-03 12:12:39 -05:00
Zach Daniel
3ff49c4fcb improvement: support new date expressions 2023-03-03 12:11:29 -05:00
Marco
ccedbc0e46
Improve postgres documentation code (#133) 2023-02-25 19:57:18 -05:00
Zach Daniel
b936b812a1 chore: release version v1.3.15 2023-02-23 17:34:16 -05:00
Zach Daniel
d07083e642 improvement: add aggregates used by sorts 2023-02-21 19:45:07 -05:00
Zach Daniel
3b9377b460 chore: fix hex_api_key secret ref 2023-02-21 10:28:39 -05:00
Zach Daniel
08df325f39 chore: release version v1.3.14 2023-02-21 10:27:36 -05:00
Zach Daniel
c7e91300bb chore: update ci to do pull requests 2023-02-21 10:27:13 -05:00
Zach Daniel
b4fa4d0d9d chore: update ash_postgres and fix credo 2023-02-21 10:26:36 -05:00
Darren Black
587182998e
improvement: Implement string_join expr (#132) 2023-02-21 10:21:53 -05:00
Zach Daniel
c70fffba58 ci: add hex api key secret 2023-02-18 10:59:06 -05:00
Zach Daniel
c5579c62f0 chore: release version v1.3.13 2023-02-17 15:24:59 -05:00
Zach Daniel
49b94fd183 fix: don't use :distinct when uniq? is not true 2023-02-17 15:21:50 -05:00
Zach Daniel
d6ed4c6b2e chore: release version v1.3.12 2023-02-16 16:12:52 -05:00
Zach Daniel
03f8fee3d1 fix: exclude order_by when building aggregates 2023-02-16 16:12:28 -05:00
Zach Daniel
43c7d35085 chore: release version v1.3.11 2023-02-16 15:24:20 -05:00
Zach Daniel
67132c41bd fix: properly find migration directories in umbrella apps 2023-02-16 15:23:50 -05:00
Zach Daniel
48488c7bad fix: don't double-cast to array for list aggregates 2023-02-13 13:30:47 -05:00
Zach Daniel
128d8a2be8 improvement: significantly optimize aggregate queries 2023-02-12 23:18:08 -05:00
Zach Daniel
589fb4d620 improvement: better type casting for concat operator 2023-02-12 19:09:25 -05:00
Zach Daniel
8eabbde953 add tests for new transaction behavior 2023-02-10 15:41:41 -05:00
Zach Daniel
4f59b15f17 chore: release version v1.3.10 2023-02-09 17:49:52 -05:00
Zach Daniel
bbb45f3622 fix: sorting on optimized first aggregates 2023-02-09 17:49:37 -05:00
Zach Daniel
0650a76105 chore: release version v1.3.9 2023-02-09 16:10:06 -05:00
Zach Daniel
8e8a308cd2 improvement: support new uniq? option on count/list aggregates 2023-02-09 16:09:44 -05:00
Zach Daniel
b76289f39f docs: add AshPostgres module to the documentation 2023-02-08 22:56:00 -05:00
Zach Daniel
80cd06818d improvement: optimized first aggregates where possible 2023-02-08 14:46:29 -05:00
Zach Daniel
8d45e92fc2 fix: do limit/offset outside of query if distinct is required 2023-02-07 19:15:44 -05:00
Zach Daniel
b41d383b47 fix: load by __order__ ascending 2023-02-07 17:43:53 -05:00
Zach Daniel
627151afc1 chore: release version v1.3.8 2023-02-06 00:20:03 -05:00
Zach Daniel
610bfc0239 chore: update mix.lock 2023-02-06 00:19:21 -05:00
zimt28
d0bc394e36
fix: Actually use AshPostgres.Repo behaviour (#129) 2023-02-05 12:46:44 -05:00
Zach Daniel
82ae1d8754 chore: update version in readme 2023-02-05 12:42:16 -05:00
Zach Daniel
93e2a786f4 improvement: authorization filters are now attached by ash core 2023-02-04 01:56:06 -05:00
Zach Daniel
7dd1681b0f chore: release version v1.3.6 2023-02-03 11:44:49 -05:00
Zach Daniel
dc74dd534c fix: properly set next migration name 2023-02-03 11:44:34 -05:00
Zach Daniel
cc643393d9 improvement: add migration_ignore_attributes
chore: update ash, fix ci
2023-02-01 02:05:04 -05:00
Zach Daniel
c3979377bd ci: use new postgres flag in CI 2023-01-31 22:47:08 -05:00
Zach Daniel
85e6ba9598 chore: add tool-versions 2023-01-31 22:35:24 -05:00
Zach Daniel
45e88e8405 chore: use new ci 2023-01-31 22:35:12 -05:00
Alan Heywood
09092cc051 test: demonstrate issue loading aggregate
Calling Api.load! to load an aggregate on an existing record, where
the aggregated record has a relates_to_actor_via policy on it causes
the following error. Note that this error was recently fixed when
loading the aggregate as part of the query.

1) test relates to actor via has_many and with an aggregate (AshPostgres.AggregateTest)
     test/aggregate_test.exs:8
     ** (RuntimeError) Could not determined related for `exists/2` expression.

     Context Resource: %{aggregates: %{}, calculations: %{}, data_layer: AshPostgres.DataLayer, public?: false, relationship_path: [], resource: AshPostgres.Test.Comment, root_resource: AshPostgres.Test.Comment}
     Context Relationship Path: []
     At Path: []
     Path: [:organization, :users]
     Related: nil
     Expression: exists(organization.users, [id: "df84db36-b8de-485b-8e47-a86307588f79"])

     code: |> Api.load!(:count_of_comments, actor: user)
     stacktrace:
       (ash 2.5.13) lib/ash/filter/filter.ex:2121: Ash.Filter.add_expression_part/3
       (ash 2.5.13) lib/ash/filter/filter.ex:2037: anonymous fn/3 in Ash.Filter.parse_expression/2
       (elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
       (elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
       (ash 2.5.13) lib/ash/filter/filter.ex:295: Ash.Filter.parse/5
       (ash 2.5.13) lib/ash/query/query.ex:1803: Ash.Query.do_filter/2
       (elixir 1.14.2) lib/map.ex:883: Map.update!/3
       (ash 2.5.13) lib/ash/engine/request.ex:654: Ash.Engine.Request.apply_filter/4
       (ash 2.5.13) lib/ash/engine/request.ex:561: Ash.Engine.Request.do_strict_check/3
       (ash 2.5.13) lib/ash/engine/request.ex:522: anonymous fn/2 in Ash.Engine.Request.strict_check/2
       (elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
       (elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
       (ash 2.5.13) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
       (ash 2.5.13) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
       (ash 2.5.13) lib/ash/engine/engine.ex:650: Ash.Engine.advance_request/2
       (ash 2.5.13) lib/ash/engine/engine.ex:556: Ash.Engine.fully_advance_request/2
       (ash 2.5.13) lib/ash/engine/engine.ex:497: Ash.Engine.do_run_iteration/2
       (elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
       (ash 2.5.13) lib/ash/engine/engine.ex:440: Ash.Engine.run_iteration/1
       (ash 2.5.13) lib/ash/engine/engine.ex:257: Ash.Engine.run_to_completion/1
       (ash 2.5.13) lib/ash/engine/engine.ex:202: Ash.Engine.do_run/2
       (ash 2.5.13) lib/ash/engine/engine.ex:141: Ash.Engine.run/2
       (ash 2.5.13) lib/ash/actions/read.ex:170: Ash.Actions.Read.do_run/3
       (ash 2.5.13) lib/ash/actions/read.ex:90: Ash.Actions.Read.run/3
       (ash 2.5.13) lib/ash/api/api.ex:928: Ash.Api.load/4
       (ash 2.5.13) lib/ash/api/api.ex:902: Ash.Api.load!/4
       test/aggregate_test.exs:48: (test)
2023-01-31 10:35:33 +10:00
Zach Daniel
5875b68484 chore: update ash in CI and mix.lock 2023-01-30 13:45:21 -05:00
Alan Heywood
1dbd7f619d Update test to demo issue with policy on aggregate
The issue occurs when an aggregate is loaded, and the aggregated
resource itself has a relates_to_actor_via policy.

The following error is produced at test/aggregate_test.exs:42

  1) test relates to actor via has_many and with an aggregate (AshPostgres.AggregateTest)
     test/aggregate_test.exs:8
     ** (RuntimeError) Could not determined related for `exists/2` expression.

     Context Resource: %{aggregates: %{count_of_comments: #count<comments from #Ash.Query<resource: AshPostgres.Test.Comment>>}, calculations: %{}, data_layer: AshPostgres.DataLayer, public?: false, relationship_path: [], resource: AshPostgres.Test.Post, root_resource: AshPostgres.Test.Post}
     Context Relationship Path: []
     At Path: []
     Path: [:post, :organization, :users]
     Related: nil
     Expression: exists(post.organization.users, [id: "236f08bc-6a3a-4a78-9911-2c24189dafac"])

     code: |> Api.read_one!()
     stacktrace:
       (ash 2.5.12) lib/ash/filter/filter.ex:2121: Ash.Filter.add_expression_part/3
       (ash 2.5.12) lib/ash/filter/filter.ex:2037: anonymous fn/3 in Ash.Filter.parse_expression/2
       (elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
       (elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
       (ash 2.5.12) lib/ash/filter/filter.ex:295: Ash.Filter.parse/5
       (ash 2.5.12) lib/ash/filter/filter.ex:995: Ash.Filter.add_to_filter/6
       (ash 2.5.12) lib/ash/query/query.ex:1797: Ash.Query.do_filter/2
       (elixir 1.14.2) lib/map.ex:883: Map.update!/3
       (ash 2.5.12) lib/ash/engine/request.ex:650: Ash.Engine.Request.apply_filter/4
       (ash 2.5.12) lib/ash/engine/request.ex:557: Ash.Engine.Request.do_strict_check/3
       (ash 2.5.12) lib/ash/engine/request.ex:518: anonymous fn/2 in Ash.Engine.Request.strict_check/2
       (elixir 1.14.2) lib/enum.ex:4751: Enumerable.List.reduce/3
       (elixir 1.14.2) lib/enum.ex:2514: Enum.reduce_while/3
       (ash 2.5.12) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
       (ash 2.5.12) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
       (ash 2.5.12) lib/ash/engine/engine.ex:650: Ash.Engine.advance_request/2
       (ash 2.5.12) lib/ash/engine/engine.ex:556: Ash.Engine.fully_advance_request/2
       (ash 2.5.12) lib/ash/engine/engine.ex:497: Ash.Engine.do_run_iteration/2
       (elixir 1.14.2) lib/enum.ex:2468: Enum."-reduce/3-lists^foldl/2-0-"/3
       (ash 2.5.12) lib/ash/engine/engine.ex:257: Ash.Engine.run_to_completion/1
       (ash 2.5.12) lib/ash/engine/engine.ex:202: Ash.Engine.do_run/2
       (ash 2.5.12) lib/ash/engine/engine.ex:141: Ash.Engine.run/2
       (ash 2.5.12) lib/ash/actions/read.ex:170: Ash.Actions.Read.do_run/3
       (ash 2.5.12) lib/ash/actions/read.ex:90: Ash.Actions.Read.run/3
       (ash 2.5.12) lib/ash/api/api.ex:1005: Ash.Api.read_one/3
       (ash 2.5.12) lib/ash/api/api.ex:998: Ash.Api.read_one!/3
       test/aggregate_test.exs:43: (test)
2023-01-30 16:09:48 +10:00