Commit graph

42 commits

Author SHA1 Message Date
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
Zach Daniel
e7ea1f9f5f chore: rename migration file 2021-03-29 11:12:31 -04:00
regularfellow
2807b191fc
chore: Test creating resource with uuid or integer primary key (#48)
Co-authored-by: Zach Daniel <zachary.s.daniel@gmail.com>
2021-03-29 11:03:45 -04:00
Zach Daniel
eb703efe6f fix: better embedded filters, switch to latest ash 2021-02-24 13:59:49 -05:00
Zach Daniel
c5f69eaa69 chore: WIP on polymorphic associations 2021-01-31 16:39:59 -05:00
Zach Daniel
9d5583cce7 chore: WIP on polymorphic relationships 2021-01-28 19:42:55 -05:00
Zach Daniel
fbc42ce87a fix: rework the way multitenant migrations work
feat: add `mix ash_postgres.create`

feat: add `mix ash_postgres.migrate`

feat: add `mix ash_postgres.migrate --tenants`

feat: add `mix ash_postgres.drop`
2021-01-26 19:16:29 -05:00
Zach Daniel
5b3fd3f144 feat: support latest ash + contains 2021-01-23 22:45:15 -05:00
Zach Daniel
03510dae24
feat: multitenancy (#25) 2020-10-28 22:26:45 -04:00
Zach Daniel
493cfb7754
feat: update to latest ash, trigram filter 2020-10-06 01:39:47 -04:00
Zach Daniel
24b743d31b
feat: snapshot-based migration generator 2020-09-10 20:26:47 -04:00
Zach Daniel
60c18dd149
test: Start test suite (#16) 2020-09-03 04:18:11 -04:00