Zach Daniel
2b91ebe488
fix: ensure proper return value for single aggregate runs
2024-02-21 09:56:33 -05:00
Zach Daniel
b5b1077032
chore: fix recursion error in to_many_path?
2024-02-20 22:13:23 -05:00
Zach Daniel
38d1beb0d8
fix: properly handle to_many joins in aggregates
...
fix: honor aggregate query filters
2024-02-20 18:38:35 -05:00
Zach Daniel
557bc6019c
fix: handle non-inner joins in delete_all
...
fix: handle non-inner joins in update
2024-02-19 13:29:41 -05:00
Zach Daniel
7cbe482fc9
fix: don't update_all or delete_all with order_by
2024-02-19 12:40:26 -05:00
Zach Daniel
0979756b0b
fix: handle updating from queries w/ non-inner initial joins
2024-02-19 11:56:48 -05:00
Minsub Kim
96c367689d
test: filter by has_one from_many? ( #209 )
2024-02-19 09:04:14 -05:00
Zach Daniel
3fd5a7a907
test: add some tests for atomics
2024-02-15 10:54:20 -05:00
Zach Daniel
2d18c9cbeb
fix: properly alter renaming attributes in migration generator
...
fixes #207
2024-02-15 09:23:48 -05:00
Zach Daniel
256b4d0b9a
test: add test for filter policy on bulk actions
2024-02-14 17:54:28 -05:00
Zach Daniel
7a4fe87561
chore: update ash, add tests
2024-02-14 13:56:58 -05:00
Zach Daniel
3146d5f97d
chore: update ash, add tests for field policies
2024-02-14 11:04:06 -05:00
Barnabas Jovanovics
be15759de0
test: add test to show problem with field policies in filters ( #206 )
2024-02-14 10:25:25 -05:00
Zach Daniel
6d0a29f45c
chore: credo
2024-02-12 10:24:59 -05:00
Zach Daniel
03b630396c
test: update tests to demonstrate streaming update
2024-02-10 18:31:34 -05:00
Barnabas Jovanovics
3f7bdb8fc1
test: add test for parent in relationship filter ( #203 )
2024-02-06 10:04:35 -05:00
Zach Daniel
b018262637
test: add new test verifying batch destroy behavior
...
chore: add sobelow warning skip
2024-02-01 13:09:06 -05:00
Zach Daniel
d71cb81792
improvement: handle if select is present on query
2024-01-31 16:30:23 -05:00
Zach Daniel
6ceac063f8
chore: credo
2024-01-30 20:55:13 -05:00
Alan Heywood
745a3b8264
test: add failing test to demo bug with changeset loading related data ( #200 )
2024-01-30 20:04:42 -05:00
Zach Daniel
5006a195bd
test: add test reproducing ash core fix for expression calculations
2024-01-30 16:39:17 -05:00
Zach Daniel
82dd14b953
chore: credo
2024-01-30 15:32:50 -05:00
Zach Daniel
8c43deea9b
fix: properly build subqueries when required for relationship queries
2024-01-30 15:21:59 -05:00
Barnabas Jovanovics
fbd41407c3
test: add test that shows subquery error ( #199 )
2024-01-30 13:17:40 -05:00
Zach Daniel
ffafa6c9f5
improvement: support Ash.Changeset.OriginalDataNotAvailable
2024-01-30 12:49:52 -05:00
Alan Heywood
aad5f9a182
test: add failing test to demonstrate bug with manual updates ( #198 )
2024-01-30 09:26:39 -05:00
Zach Daniel
4930a69b95
improvement: support count_nils
expression
2024-01-29 17:17:32 -05:00
Ryan
64e117603a
fix: Correct the matching used in building a distinct expression ( #196 )
2024-01-26 15:04:54 -05:00
Dmitry Maganov
8f3100a381
fix: keep fields of custom_index
in format that they were provided ( #195 )
2024-01-22 11:32:34 -05:00
Zach Daniel
f20a07f54b
improvement: support latest ash changes
2024-01-19 00:12:50 -05:00
Zach Daniel
97847da734
fix: include explicit schema in snapshot folder name
...
closes #193
2024-01-16 23:44:49 -05:00
Zach Daniel
b93b1d722b
improvement: support all_tenants?
option for identities
...
improvement: support `all_tenants?` option for custom indexes
2024-01-12 10:11:16 -05:00
Zach Daniel
f3ccb78f86
improvement: support join_filters on aggregates
...
fix: subquery relationships that have filters
2024-01-11 22:30:35 -05:00
Zach Daniel
9b5acd98f7
chore: credo, dialyzer, format
2024-01-10 08:34:23 -05:00
Eduardo B. Alexandre
d5d312de56
feat: Add unit test to check lateral joins
...
with custom schemas and tables
2024-01-10 08:19:10 -05:00
Zach Daniel
76e23b186f
test: add some tests for aggregate refs in calcs
2024-01-10 07:22:25 -05:00
Zach Daniel
c0c9621534
improvement: support new bulk operations
...
fix: support encoding errors with expressions in them
2023-12-31 08:40:30 -05:00
Zach Daniel
2a2fd30e33
improvement: support new return_query/2
callback
...
improvement: support new `:no_rollback` error signal
2023-12-29 21:49:34 -05:00
Zach Daniel
89a4363c1f
improvement: support directly referencing aggregates from aggregates
2023-12-23 10:39:54 -05:00
Zach Daniel
68e2f74fe0
improvement: support aggregates using other aggregates
...
fix: various fixes for unnecessary aggregate additions
test: added a test to confirm context based multitenancy behavior
2023-12-22 21:14:40 -05:00
Zach Daniel
9bc5b2af9f
improvement: support string_length and string_trim
2023-12-21 19:52:29 -05:00
Zach Daniel
9ca9272426
improvement: only start savepoints when necessary
2023-12-21 16:56:57 -05:00
Zach Daniel
61d229c685
fix: use lateral joins when joining to subquery w/ parent reference
2023-12-19 18:15:00 -05:00
Barnabas Jovanovics
c916034931
fix: replace upsert field with source in EXCLUDED fragment ( #187 )
2023-12-19 15:05:05 +01:00
Zach Daniel
ac980a2163
chore: fix error expression
2023-12-15 08:48:20 -05:00
Zach Daniel
407a7163ed
improvement: support for error/2
expression
2023-12-14 17:10:11 -05:00
Zach Daniel
07499b6ec0
fix: use maps for composite_type instead of tuples
2023-11-29 10:27:10 -05:00
Zach Daniel
74ef0aa6c3
improvement: support composite_type/2
expression
2023-11-29 09:57:10 -05:00
Zach Daniel
592e79a2f9
improvement: support composite types
2023-11-27 17:47:54 -05:00
Zach Daniel
c53f1733be
chore: format
2023-11-22 14:29:47 -05:00
Barnabas Jovanovics
179cee4b24
chore: add test ( #184 )
2023-11-22 13:37:54 -05:00
Zach Daniel
b133d63edd
chore: remove unused aliases
2023-11-21 09:33:29 -05:00
Zach Daniel
3fc3740dde
chore: comment out test for now
2023-11-21 09:26:02 -05:00
Daniel Newman
6cc36c9684
Remove test duplicate from merge conflict
2023-11-21 09:25:24 -05:00
Daniel Newman
ff6c038757
Error using calc to agg to calc to agg
2023-11-21 09:25:24 -05:00
Daniel Newman
8caad3bf7d
Adjust tests for updates from upstream
2023-11-21 09:25:24 -05:00
Riccardo Binetti
021b7e4233
improvement: allow specifying multi-column foreign keys ( #180 )
...
* improvement: add match_with option on references
* improvement: add match_type option on references
2023-11-20 16:52:50 -05:00
Zach Daniel
fcda627050
fix: hydrate aggregate refs when adding for calculations
2023-11-20 07:05:47 -05:00
Daniel Newman
4278f31736
Implement test and resources to show reference bug
2023-11-20 06:40:22 -05:00
Zach Daniel
b52fc0b429
chore: improve matrix behavior and update exists tests
2023-11-17 07:10:37 -05:00
Zach Daniel
c6e6633a9a
fix: properly expand calculation values across aggregate invocations
2023-11-17 04:01:35 -05:00
Daniel Newman
06510b2770
Error using calc to agg to calc to agg
2023-11-16 20:47:25 -05:00
Zach Daniel
ef96cd541e
fix: use synonymous_relationship_path
when looking up ref bindings
2023-11-16 11:02:24 -05:00
Alan Heywood
af8d8dbcac
test: add failing test to demo an issue with has_one calculations
2023-11-16 11:02:02 -05:00
Zach Daniel
db8255e5b1
improvement: support a 2 argument function for the repo option
2023-11-14 10:56:22 -05:00
Zach Daniel
cae89d856e
fix: get resource from proper bindings on exists
query
2023-11-13 17:42:37 -05:00
Zach Daniel
342920a3c4
improvement: support parent
in sort expressions
2023-10-26 09:47:56 -04:00
Zach Daniel
52302046e1
fix: properly join to related references in relationship filters
2023-10-24 12:25:23 -04:00
Zach Daniel
1a6e469e57
improvement: support atomics on upserts
2023-10-11 15:17:50 -04:00
Zach Daniel
f67db5ee6d
chore: handle ci_string type as storage type
2023-10-10 14:16:25 -04:00
Zach Daniel
772c12b5a3
fix: don't run main query if only exists
aggs are specified
...
fixes : #170
2023-10-10 09:43:09 -04:00
Zach Daniel
270d8685e7
improvement: support to-one references in calculations
2023-10-09 18:57:06 -04:00
Alessio Montagnani
0adec1d163
* improvement: in multitenant resources migration's generation, check if the relationship points at the primary key of the target then not adding the multitenancy attribute ( #144 and #157 )
2023-09-25 15:33:28 -04:00
Zach Daniel
b35f8c715b
improvement: add AshPostgres.Tsquery
2023-09-20 16:41:32 -04:00
James Harton
6cc88c82b4
improvement: Allow resources to opt out of the primary key requirement. ( #166 )
2023-09-06 01:18:57 -04:00
Zach Daniel
33eb4f9fb7
improvement: better error message for missing table config
2023-09-04 11:25:03 -04:00
Zach Daniel
9f77304b22
fix: don't clobber loaded data on update
2023-08-31 13:04:08 -04:00
Zach Daniel
eabb745fc3
chore: update tests for latest ash atomics support
2023-08-31 11:47:15 -04:00
Zach Daniel
5a4a52854b
improvement: support atomics ( #165 )
2023-08-28 16:18:56 -04:00
Zach Daniel
cbde3958f3
fix: properly handle ensure nsted calls to get_path
are jsonb
2023-08-23 12:54:25 -04:00
Zach Daniel
99b2a5631c
improvement: support in-line aggregates
...
fix: support non-atom named aggregates
2023-08-22 14:51:31 -04:00
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
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
Alan Heywood
acc947292d
Add failing test for inserting via Ecto.Repo.insert!
...
It should be possible to use this function, and it did work as of ash
v2.5.9. This test fails as of ash v2.5.10, which introduced adding
relationships to underlying ecto schemas. The bug is related to a
has_many relationship being present on the resource.
The test fails with:
1) test call Ecto.Repo.insert! via Ash Repo (AshPostgres.EctoCompatibilityTest)
test/ecto_compatibility_test.exs:6
** (Ecto.InvalidChangesetError) could not perform insert because changeset is invalid.
Errors
%{posts: [{"is invalid", [type: {:array, :map}]}]}
Applied changes
%{name: "The Org"}
Params
nil
Changeset
#Ecto.Changeset<
action: :insert,
changes: %{name: "The Org"},
errors: [posts: {"is invalid", [type: {:array, :map}]}],
data: #AshPostgres.Test.Organization<>,
valid?: false
>
code: |> AshPostgres.TestRepo.insert!()
stacktrace:
(ecto 3.9.4) lib/ecto/repo/schema.ex:270: Ecto.Repo.Schema.insert!/4
test/ecto_compatibility_test.exs:9: (test)
2023-01-30 10:40:45 +10:00
Zach Daniel
04a64b8b94
chore: credo
2023-01-29 18:24:11 -05:00
Alan Heywood
f290ae47b8
Add failing test for policy + aggregate issue
...
The conditions for this issue to occur seem to be:
- DataLayer is Postgres
- Resource has a relates_to_actor_via policy on read
- The relates_to_actor_via path includes a has_many relationship
- An aggregate is loaded
The following error is produced:
1) test relates to actor via has_many and with an aggregate (AshPostgres.AggregateTest)
test/aggregate_test.exs:8
** (Ash.Error.Unknown.UnknownError) ** (ArgumentError) No such entity nil found.
code: |> Api.read_one!(actor: user)
stacktrace:
nil.spark_dsl_config()
(spark 0.3.8) lib/spark/dsl/extension.ex:129: Spark.Dsl.Extension.dsl!/1
(spark 0.3.8) lib/spark/dsl/extension.ex:158: Spark.Dsl.Extension.get_persisted/3
(ash 2.5.10) lib/ash/filter/filter.ex:2986: Ash.Filter.do_hydrate_refs/2
(ash 2.5.10) lib/ash/policy/check/relates_to_actor_via.ex:3: Ash.Policy.Check.RelatesToActorVia.try_eval/2
(ash 2.5.10) lib/ash/policy/check/relates_to_actor_via.ex:3: Ash.Policy.Check.RelatesToActorVia.try_strict_check/3
(ash 2.5.10) lib/ash/policy/checker.ex:63: Ash.Policy.Checker.do_strict_check_facts/3
(ash 2.5.10) lib/ash/policy/checker.ex:88: anonymous fn/2 in Ash.Policy.Checker.strict_check_policies/3
(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.10) lib/ash/policy/checker.ex:9: anonymous fn/2 in Ash.Policy.Checker.strict_check_facts/1
(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.10) lib/ash/policy/authorizer.ex:790: Ash.Policy.Authorizer.do_strict_check_facts/1
(ash 2.5.10) lib/ash/policy/authorizer.ex:372: Ash.Policy.Authorizer.strict_check/2
(ash 2.5.10) lib/ash/engine/request.ex:550: Ash.Engine.Request.do_strict_check/3
(ash 2.5.10) 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.10) lib/ash/engine/request.ex:255: Ash.Engine.Request.do_next/1
(ash 2.5.10) lib/ash/engine/request.ex:211: Ash.Engine.Request.next/1
(ash 2.5.10) lib/ash/engine/engine.ex:650: Ash.Engine.advance_request/2
(ash 2.5.10) lib/ash/engine/engine.ex:556: Ash.Engine.fully_advance_request/2
(ash 2.5.10) 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.10) lib/ash/engine/engine.ex:440: Ash.Engine.run_iteration/1
(ash 2.5.10) lib/ash/engine/engine.ex:257: Ash.Engine.run_to_completion/1
(ash 2.5.10) lib/ash/engine/engine.ex:202: Ash.Engine.do_run/2
(ash 2.5.10) lib/ash/engine/engine.ex:141: Ash.Engine.run/2
(ash 2.5.10) lib/ash/actions/read.ex:170: Ash.Actions.Read.do_run/3
(ash 2.5.10) lib/ash/actions/read.ex:90: Ash.Actions.Read.run/3
(ash 2.5.10) lib/ash/api/api.ex:1005: Ash.Api.read_one/3
(ash 2.5.10) lib/ash/api/api.ex:998: Ash.Api.read_one!/3
test/aggregate_test.exs:44: (test)
2023-01-29 16:15:16 +10:00
Zach Daniel
3c496512e2
fix: use parent_expr
instead of this
...
fix: various expression & type building fixes
2023-01-06 17:05:23 -05:00
Zach Daniel
e81e77840a
fix: don't group aggregates that reference relationships in their filters
2022-12-21 16:58:12 -05:00
Zach Daniel
09b19c8bfd
improvement: add like and ilike
2022-12-21 16:12:49 -05:00
Zach Daniel
01d1a8aa5d
test: add test confirming embedded array behavior
2022-12-18 02:35:42 -05:00
Zach Daniel
a5b1bc8a3f
fix: properly add aggregates to query when referenced from calculations
...
fixes : #127
2022-12-18 02:23:39 -05:00
Alan Heywood
df3b4fd82c
Add a failing test to repro a bug with calculation loads
2022-12-17 22:57:25 +10:00
Zach Daniel
bfefef7fd5
improvement: distinct on source of query, not relationship destination
2022-12-15 17:16:53 -05:00
Zach Daniel
5987515b8d
fix: properly combine sort + to many join filter
2022-12-14 22:37:10 -05:00
Zach Daniel
9d6996be25
fix: make migration generator work better for umbrellas
2022-12-13 13:31:57 -05:00
Zach Daniel
68c6d7aaf8
improvement: better error messages from mix tasks
...
fix: various broken behavior from new aggregate work
improvement: validate that references refer to relationships
closes #99
2022-12-10 15:59:50 -05:00
Zach Daniel
e271a27d3c
improvement: avg/min/max/custom aggregate support
...
fix: fix various problems with the model behind aggregates
2022-12-07 20:32:38 -05:00
Zach Daniel
7d0663588f
chore: add test with join in many to many
2022-12-04 13:39:58 -05:00
Zach Daniel
52fcba79ac
improvement: inform users about postgres incompatibility with multidimensional arrays
2022-12-01 20:24:49 -05:00
Darren Black
f088601cf9
Failing tests for aggregates on arrays ( #121 )
2022-11-30 21:26:58 -05:00
Zach Daniel
f03332c13b
chore: fix tests
2022-11-30 20:59:18 -05:00