Commit graph

61 commits

Author SHA1 Message Date
Zach Daniel
4db1b80eb1 fix: ensure that from_many? joins are properly limited
fix: ensure that lateral joins are properly filtered
2024-02-29 09:22:37 -05:00
Zach Daniel
cfebfa278a chore: fix dialyzer issue 2024-02-29 00:07:56 -05:00
Zach Daniel
23dd650100 test: test improvements, regression test 2024-02-28 21:24:31 -05:00
Zach Daniel
37cb3825f1 fix: properly handle complex types in lists 2024-02-23 20:53:19 -05:00
Barnabas Jovanovics
fbd41407c3
test: add test that shows subquery error (#199) 2024-01-30 13:17:40 -05:00
Zach Daniel
4930a69b95 improvement: support count_nils expression 2024-01-29 17:17:32 -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
c0c9621534 improvement: support new bulk operations
fix: support encoding errors with expressions in them
2023-12-31 08:40:30 -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
8d482674a0 chore: generate migrations 2023-11-29 09:14:57 -05:00
Zach Daniel
592e79a2f9 improvement: support composite types 2023-11-27 17:47:54 -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
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
cbde3958f3 fix: properly handle ensure nsted calls to get_path are jsonb 2023-08-23 12:54:25 -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
c1a630ee16 improvement: support string_split 2023-07-12 15:16:28 -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
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
Alan Heywood
df3b4fd82c Add a failing test to repro a bug with calculation loads 2022-12-17 22:57:25 +10:00
Zach Daniel
7d0663588f chore: add test with join in many to many 2022-12-04 13:39:58 -05:00
Zach Daniel
059837651d improvement: add unique constraints to changeset for custom unique indexes
improvement: separate out concurrent index creations and do them in a separate transaction
2022-11-25 14:06:22 -05:00
Zach Daniel
5222e1e755 improvement: handle UUID types better 2022-10-17 08:40:32 -05:00
Darren Black
b0292d66f8
improvement: implement Length function (#111) 2022-09-15 16:51:49 -04:00
Zach Daniel
4a69edce2d important: update to ash 2.0 branch 2022-08-24 12:07:38 -04:00
Zach Daniel
eb2bd267cb improvement: fix typecasting for calculations & embed access
chore: rebuild test migrations
2022-08-05 15:27:22 -04:00
Zach Daniel
0f9a433c95 improvement: support || and && 2022-07-20 14:19:06 -04:00
Zach Daniel
559f60c339 improvement: add default guide, and empty ash postgres guide 2022-07-14 12:13:54 -04:00
Zach Daniel
f791305d5f fix: use new doc_index patterns 2022-07-10 16:26:57 -04:00
Zach Daniel
c52917bca1 improvement: set update_defaults on upsert results 2022-07-06 14:44:18 -04:00
Zach Daniel
824748b0ab fix: support upsert_identity with base filters 2022-07-01 19:12:01 -04:00
Zach Daniel
da07ed7b6c fix: handle various join bugs 2022-06-29 15:08:49 -04:00
Zach Daniel
d04fd201f2 fix: test and confirm behavior of schemas 2022-05-22 18:30:20 -04:00
Zach Daniel
2a5c7ac4a2 improvement: check_migrations, rename to --check
fix: don't use `table` where we should use `schema` in migration generator
2022-05-18 13:21:58 -04:00
Zach Daniel
a6577d5175 chore: test enum types 2022-02-09 12:13:11 -05:00
Zach Daniel
e2bd3c5aec improvement: support access syntax 2022-02-07 16:48:36 -05:00
Zach Daniel
98004f3251 fix: handle new if types
improvement: relax ash version requirement
2021-11-13 14:48:14 -05:00
Zach Daniel
9a97cb682d chore: work on tests 2021-11-13 13:57:00 -05:00
Frank Dugan III
b353b63b82
test: Add failing test for calculations load nullable timestamp aggregates compared to a fragment (#76) 2021-11-13 13:56:14 -05:00
Zach Daniel
5e5b5f3fc0 fix: interaction w/ attribute and context tenancy 2021-07-24 11:28:58 -04:00
Zach Daniel
dae39f5fda feat: support expression based calculations
feat: support concat + if expressions
improvement: various other improvements
2021-06-04 01:48:35 -04:00
Zach Daniel
7115bec586 feat: support new side load improvements 2021-04-29 17:31:34 -04:00
Zach Daniel
b7efe6e078 improvement: custom index names
fix: simpler index names
2021-04-27 17:16:56 -04:00
Zach Daniel
8bcc2a16eb fix: stringify struct defaults in migration generator 2021-04-26 13:21:57 -04:00
Zach Daniel
301f05604c improvement: support ash enums 2021-04-21 13:50:11 -04:00
Zach Daniel
1f6621b852 feat: add check_constraints, both for validation and migrations 2021-04-19 14:26:41 -04:00
Michael St Clair
cf92fe14a5
improvement: add sum aggregate (#53) 2021-04-04 16:05:41 -04:00
Zach Daniel
4d2d29d976 feat: support configuring references
feat: support configuring polymorphic references
feat: support `distinct` Ash queries
2021-04-01 02:19:30 -04:00