Commit graph

74 commits

Author SHA1 Message Date
Zach Daniel
52f0250652 chore: generate migrations 2024-07-15 09:54:09 -04:00
Robert Timis
27f63d8d8e
error reproduction test (#349) 2024-07-13 16:06:52 -04:00
Zach Daniel
ef58c78313 test: add more tests for atomic update interactions
chore: get build passing
2024-07-12 23:23:42 -04:00
Alessio Montagnani
72b029be21
improvement: add support for :uuid_v7 type (#333) 2024-07-09 19:57:38 -04:00
Barnabas Jovanovics
3385bd21f1
improvement: add storage type option (#342)
---------

Co-authored-by: Zach Daniel <zach@zachdaniel.dev>
2024-07-08 09:54:50 -04:00
Zach Daniel
bc42cce55b chore: generate migrations 2024-07-03 11:52:01 -04:00
Zach Daniel
7d41e69a11 chore: gen migrations 2024-07-02 12:46:03 -04:00
Zach Daniel
e42665b14c chore: update to latest igniter 2024-07-01 21:34:47 -04:00
Barnabas Jovanovics
2a1bc993eb
test: update tests to show many_to_many filter problem (#309) 2024-06-18 09:03:24 -04:00
Zach Daniel
860d085386 fix: update ash_sql to fix query generation issues 2024-06-18 07:50:54 -04:00
Zach Daniel
cacf71cd55 fix: ensure that parens are always added to calculation generated SQL 2024-06-17 15:34:05 -04:00
Zach Daniel
85620a0f89 improvement: don't sort identity keys.
There are important implications here, specifically that there are
optimizations that can be had based on what the first column in a
unique constraint is, and we want to make sure that can be taken advantage of.

closes #313
2024-06-10 15:59:05 -04:00
Zach Daniel
8e32e0ab9a fix: ensure that context multitenancy is properly applied to lateral many-to-many joins 2024-06-10 12:49:04 -04:00
Zach Daniel
8ad92cc3c0 improvement: update ash and support new identity features 2024-05-24 01:14:55 -04:00
Riccardo Binetti
0313734db0
chore: failing test for calculation ordered paginated relationship (#292) 2024-05-20 10:06:49 -04:00
Riccardo Binetti
ad0b1a5c6c
chore: add relationship pagination tests (#265) 2024-05-16 17:28:43 -05:00
Frank Dugan III
bc02a4d23c
feat: add timestamptz types (#266) 2024-05-05 06:08:21 -04:00
Zach Daniel
56f3a5eb2f fix: fix calculate when exprs aren't dynamics
test: add test for datetimes
2024-05-02 21:29:21 -04:00
Zach Daniel
804482b8ac improvement!: change defaults for uuids to gen_random_uuid() 2024-03-27 17:20:07 -04:00
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
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
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