Zach Daniel
c8aa2a8dd8
improvement: add value_to_postgres_default/3
and AshPostgres.Type
2023-08-18 11:22:01 -04:00
Zach Daniel
d36457336b
fix: handle case where multiple grouped aggregates depend on further aggregates
2023-08-16 23:02:56 -04:00
Alan Heywood
bac2e01b54
test: add failing test to demonstrate potential bug ( #164 )
...
1) test complex calculation (AshPostgres.Test.ComplexCalculationsTest)
test/complex_calculations_test.exs:5
** (RuntimeError) Error while building reference: latest_documentation_status
code: |> AshPostgres.Test.ComplexCalculations.Api.load!([
stacktrace:
(ash_postgres 1.3.41) lib/expr.ex:846: AshPostgres.Expr.do_dynamic_expr/5
(ash_postgres 1.3.41) lib/expr.ex:109: AshPostgres.Expr.do_dynamic_expr/5
(ash_postgres 1.3.41) lib/expr.ex:356: AshPostgres.Expr.do_dynamic_expr/5
(ash_postgres 1.3.41) lib/expr.ex:968: anonymous fn/6 in AshPostgres.Expr.do_dynamic_expr/5
(ecto 3.10.3) lib/ecto/query/builder/dynamic.ex:76: Ecto.Query.Builder.Dynamic.expand/3
(stdlib 5.0.2) lists.erl:1706: :lists.mapfoldl_1/3
(elixir 1.15.4) lib/macro.ex:653: Macro.do_traverse/4
(stdlib 5.0.2) lists.erl:1706: :lists.mapfoldl_1/3
(stdlib 5.0.2) lists.erl:1707: :lists.mapfoldl_1/3
(elixir 1.15.4) lib/macro.ex:653: Macro.do_traverse/4
(stdlib 5.0.2) lists.erl:1706: :lists.mapfoldl_1/3
(stdlib 5.0.2) lists.erl:1707: :lists.mapfoldl_1/3
(elixir 1.15.4) lib/macro.ex:653: Macro.do_traverse/4
(stdlib 5.0.2) lists.erl:1706: :lists.mapfoldl_1/3
(elixir 1.15.4) lib/macro.ex:653: Macro.do_traverse/4
(stdlib 5.0.2) lists.erl:1706: :lists.mapfoldl_1/3
(elixir 1.15.4) lib/macro.ex:653: Macro.do_traverse/4
(ecto 3.10.3) lib/ecto/query/builder/dynamic.ex:59: Ecto.Query.Builder.Dynamic.partially_expand/6
(ecto 3.10.3) lib/ecto/query/builder/select.ex:235: Ecto.Query.Builder.Select.expand_nested/3
(ecto 3.10.3) lib/ecto/query/builder/select.ex:274: Ecto.Query.Builder.Select.expand_nested_pair/3
(elixir 1.15.4) lib/enum.ex:1825: anonymous fn/3 in Enum.map_reduce/3
(stdlib 5.0.2) maps.erl:416: :maps.fold_1/4
(elixir 1.15.4) lib/enum.ex:2522: Enum.map_reduce/3
(ecto 3.10.3) lib/ecto/query/builder/select.ex:257: Ecto.Query.Builder.Select.expand_nested/3
(ecto 3.10.3) lib/ecto/query/builder/select.ex:205: Ecto.Query.Builder.Select.select!/5
(elixir 1.15.4) lib/enum.ex:2510: Enum."-reduce/3-lists^foldl/2-0-"/3
(ash_postgres 1.3.41) lib/aggregate.ex:121: anonymous fn/6 in AshPostgres.Aggregate.add_aggregates/6
(elixir 1.15.4) lib/enum.ex:4830: Enumerable.List.reduce/3
(elixir 1.15.4) lib/enum.ex:2564: Enum.reduce_while/3
(ash_postgres 1.3.41) lib/aggregate.ex:53: AshPostgres.Aggregate.add_aggregates/6
(ash 2.13.3) lib/ash/query/aggregate.ex:570: anonymous fn/6 in Ash.Query.Aggregate.value_request/9
(ash 2.13.3) lib/ash/engine/engine.ex:537: anonymous fn/2 in Ash.Engine.run_iteration/1
(ash 2.13.3) lib/ash/engine/engine.ex:558: anonymous fn/4 in Ash.Engine.async/2
(elixir 1.15.4) lib/task/supervised.ex:101: Task.Supervised.invoke_mfa/2
(elixir 1.15.4) lib/task/supervised.ex:36: Task.Supervised.reply/4
(ash 2.13.3) lib/ash/engine/engine.ex:552: Ash.Engine.async/2
(elixir 1.15.4) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
(elixir 1.15.4) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
(ash 2.13.3) lib/ash/engine/engine.ex:702: Ash.Engine.start_pending_tasks/1
(ash 2.13.3) lib/ash/engine/engine.ex:323: Ash.Engine.run_to_completion/1
(ash 2.13.3) lib/ash/engine/engine.ex:252: Ash.Engine.do_run/2
(ash 2.13.3) lib/ash/engine/engine.ex:148: Ash.Engine.run/2
(ash 2.13.3) lib/ash/actions/read.ex:173: Ash.Actions.Read.do_run/3
(ash 2.13.3) lib/ash/actions/read.ex:96: Ash.Actions.Read.run/3
(ash 2.13.3) lib/ash/api/api.ex:1733: Ash.Api.load/4
(ash 2.13.3) lib/ash/api/api.ex:1707: Ash.Api.load!/4
test/complex_calculations_test.exs:55: (test)
2023-08-16 20:49:18 -04:00
Alessio Montagnani
4a02d8c6ad
improvement: custom-extension implementation ( #162 )
...
* improvement: custom-extension implementation
* improvement: allow adding custom-extension by module's reference and fixes formatting
* ci: fixes formatter
2023-08-08 10:20:26 -07:00
Zach Daniel
7ce33cac2c
fix: handle interaction between distinct, join filters and sort
2023-08-04 22:52:56 -04:00
Zach Daniel
d2e309c126
improvement: support the new parent/1
expr in relationships
2023-07-26 17:32:09 -04:00
Zach Daniel
c7866c6c16
improvement: support new distinct_sort
option
2023-07-19 12:50:05 -04:00
Zach Daniel
c920b09277
improvement: support new distinct
features from ash core
2023-07-18 14:48:35 -04:00
Zach Daniel
ed62006b3f
improvement: support unary -/1
operator
2023-07-17 22:35:46 -04:00
Zach Daniel
062e67392a
fix: convert Ash.Resource.Aggregate
to Ash.Query.Aggregate
when adding
2023-07-13 23:27:08 -04:00
Zach Daniel
d2e071773e
improvement: support exists
aggregates
2023-07-13 00:13:50 -04:00
Zach Daniel
11ad5f4d1b
improvement: support at/2
expression
2023-07-12 17:05:33 -04:00
Zach Daniel
c1a630ee16
improvement: support string_split
2023-07-12 15:16:28 -04:00
Zach Daniel
1d96805d51
chore: cleanup nested DSL in test
2023-07-12 10:56:15 -04:00
Zach Daniel
a09dae4d26
fix: raise better error on invalid filter values
...
closes #154
We still want to build something better directly into `Ash.Filter`
that determines field types and casts them up front
2023-06-28 11:29:54 -04:00
Zach Daniel
ce9ca1ced2
chore: fix test bad identity
2023-06-27 19:14:30 -04:00
Eduardo B. A
4171ef851d
fix: Fixes multiple schema identities migrations ( #156 )
...
Co-authored-by: Eduardo <sezdocs@dev-distrobox.fedora.local>
2023-06-25 17:26:31 -04:00
Zach Daniel
6712943e74
fix: properly handle nested aggregate references
2023-06-05 18:35:22 -04:00
Zach Daniel
0ad06c6b63
test: update incorrect test
2023-05-30 22:24:22 -04:00
Zach Daniel
75a5467d35
test: format & update tests
2023-05-27 00:39:49 -04:00
Zach Daniel
06cb5b5c89
chore: update ash/tests
2023-05-26 23:59:35 -04:00
Tommaso Patrizi
96165a58ea
tests: added test for bulk upsert ( #148 )
...
Co-authored-by: Tommaso Patrizi <tommasop@gmail.com>
2023-05-26 23:58:04 -04:00
Frank Dugan III
4704253cc2
test: add test for bulk creating relationships ( #147 )
2023-05-26 09:13:24 -04:00
Zach Daniel
376717ae36
test: update tests for latest ash version
2023-05-25 10:46:07 -04:00
Zach Daniel
4a57a300da
fix: handle raised errors in bulk actions
2023-05-22 21:17:30 -04:00
Zach Daniel
f59bbee443
improvement: raise better errors on conflicting locks
2023-05-17 13:17:37 -04:00
Zach Daniel
b457c3052e
test: fix tests using filter
option on aggregates
2023-05-10 23:14:55 -04:00
Zach Daniel
2bf6725fcb
chore: fix bulk upserts
2023-05-02 22:19:01 -04:00
Zach Daniel
08a0a926e5
improvement: support bulk upserts
2023-05-02 22:16:21 -04:00
Zach Daniel
aed14f7ffd
test: add test to confirm lateral join fix in Ash
2023-05-01 14:11:33 -04:00
Zach Daniel
cd821cc153
fix: go back to old migration sorting algorithm
...
closes : #139
2023-05-01 10:51:09 -04:00
Zach Daniel
d417361012
fix: subquery aggregates when a distinct is being added
2023-04-22 01:17:38 -06:00
Zach Daniel
903b1dd2e7
improvement: update ash
...
test: update tests
2023-04-21 10:43:58 -06:00
Zach Daniel
cd54969b03
test: add test for runtime calculation using query
2023-04-20 11:37:46 -06:00
Zach Daniel
525dcc9f91
improvement: use digraph for operation ordering
...
fix: handle primary key changes properly
Doing this involves dropping all foreign keys using it, and dropping the existing
primary key before creating the new one.
2023-04-11 17:41:53 -04:00
Zach Daniel
e154c15fc9
chore: release version v1.3.19
2023-04-07 11:05:38 -04:00
Zach Daniel
7952a515fe
fix: properly handle newtypes, add test
2023-04-07 10:56:06 -04:00
Zach Daniel
31fdbec62e
chore: credo
2023-04-05 12:21:35 -04:00
Zach Daniel
4ccec4fe8b
improvement: update ash
...
chore: fix tests
2023-04-04 21:49:24 -04:00
Barnabas Jovanovics
e2ee0016ea
test: add test that reproduces dependent select problem ( #136 )
2023-03-31 12:12:13 -04:00
Darren Black
587182998e
improvement: Implement string_join expr ( #132 )
2023-02-21 10:21:53 -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
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
bbb45f3622
fix: sorting on optimized first aggregates
2023-02-09 17:49:37 -05:00
Zach Daniel
8e8a308cd2
improvement: support new uniq?
option on count/list aggregates
2023-02-09 16:09:44 -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
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