Commit graph

401 commits

Author SHA1 Message Date
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
Zach Daniel
498d54e812 improvement: update ash, add test for transaction hooks 2022-11-30 20:51:06 -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
b4efb3a343 test: fix tests for migration_defaults 2022-11-21 02:45:09 -05:00
Zach Daniel
8f064db2f0 chore: work on tests for migration_defaults 2022-11-21 02:39:57 -05:00
Zach Daniel
2451879d46 test: add test for code interface 2022-10-31 11:53:03 -04:00
Zach Daniel
dbfca0ec57 chore: format 2022-10-24 22:17:42 -06:00
Kyle Grinstead
a88687c1d5
fix: && operator in expressions to point to ash_elixir_and (#115) 2022-10-24 22:13:12 -06:00
Zach Daniel
13413d3cc7 feat: support now() in latest Ash 2022-10-20 01:08:35 -04:00
Zach Daniel
5222e1e755 improvement: handle UUID types better 2022-10-17 08:40:32 -05:00
Zach Daniel
fb8a13f33d improvement: set lateral join source for latest ash
improvement: use `prepend?: true` option when applying relationship sorts
2022-10-15 00:03:16 -05:00
Zach Daniel
a8b44fef0f fix: no unnecessary type cast on count/sum aggregates 2022-10-10 12:12:17 -04:00
Zach Daniel
7fd1e73baa fix: don't apply filter to array_agg 2022-10-10 12:06:54 -04:00
Zach Daniel
94edf64322 fix: use attribute source for identity fields 2022-10-04 16:13:52 -04:00
Zach Daniel
fd5ac60072 improvement: exists filters necessitate multiple aggregate joins (for now) 2022-09-28 18:01:20 -04:00
Zach Daniel
6ad57501ff improvement: upgrade to new exists usage 2022-09-25 14:41:29 -04:00
Zach Daniel
e8643d4aa0 fix: properly type cast top level fragments
chore: update tests not to use deprecated helper
2022-09-21 13:36:18 -04:00
Zach Daniel
31d0ec20ac improvement: support latest ash 2022-09-20 23:00:29 -04:00
Darren Black
b0292d66f8
improvement: implement Length function (#111) 2022-09-15 16:51:49 -04:00
Zach Daniel
11561ea163 improvement: support latest ash 2022-09-14 12:59:01 -04:00
Zach Daniel
7fc6c91cac improvement: support manual relationships with joins 2022-09-13 16:40:12 -04:00
Zach Daniel
79879e0bd6 fix: keep unique index keys in order in migrations
closes #109
2022-09-10 01:41:25 -04:00
Zach Daniel
170b9fc9e7 improvement: support latest ash exists/2 expr 2022-09-06 18:33:17 -04:00
Zach Daniel
4a69edce2d important: update to ash 2.0 branch 2022-08-24 12:07:38 -04:00
Zach Daniel
0fe770b9ea fix: include prefix in the proper place when renaming attributes
closes: #104
2022-08-09 16:37:20 -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
82d8d73b4d test: add test for check constraint ordering 2022-07-22 01:01:32 -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
cf212e0d98 chore: format 2022-07-01 19:18:42 -04:00
Zach Daniel
c352a1f1fa fix: support upsert_identity with base_filter 2022-07-01 19:12:14 -04:00
Zach Daniel
da07ed7b6c fix: handle various join bugs 2022-06-29 15:08:49 -04:00
Zach Daniel
53560d82ac test: add test for field_type in relationships 2022-06-28 16:01:07 -04:00
Rebecca Le
c54c67af9d
fix: rename attributes correctly in down migration (#98) 2022-05-31 12:14:05 -04:00
Josh Price
ff3039ee32
improvement: handle fallback ecto migration default elegantly (#94) 2022-05-24 12:11:32 -04:00
Zach Daniel
d04fd201f2 fix: test and confirm behavior of schemas 2022-05-22 18:30:20 -04:00
Zach Daniel
be15257531 fix: use correct bindings for filtered relationships 2022-05-22 02:12:07 -04:00
Zach Daniel
57a8716a94 chore: add failing test for #331 2022-05-22 00:43:10 -04:00
Zach Daniel
d2e5c71a6b fix: cast calcs in query expressions 2022-05-20 13:42:20 -04:00
Zach Daniel
4ec454d4f1 fix: explicitly type cast aggregate/calc selects 2022-05-20 13:22:32 -04:00
Zach Daniel
316a4408f5 chore: fix test 2022-05-18 15:47:43 -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
6c5ee9aae5 improvement: add static schema specification in DSL
improvement: support static schema specification in migration generator
2022-05-13 17:41:30 -04:00
Zach Daniel
4e85466724 fix: handle combinations of distinct & sort
closes #93
2022-05-10 22:48:04 -04:00
Josh Price
91a61b488e
fix: ensure all single actions are explicitly marked as primary? (#95) 2022-05-08 08:08:06 -04:00
Josh Price
09475e408e
improvement: implement decimal ecto migration default (#91) 2022-04-28 10:48:44 -04:00
Josh Price
157a5b33e3
improvement: support float as Ecto migration default (#89) 2022-04-27 17:10:51 -04:00
Zach Daniel
575d838d72 improvement: add atom impl for EctoMigrationDefault 2022-04-21 10:36:34 -04:00
Zach Daniel
0c757d5049 chore: update for latest ash changes 2022-04-19 11:08:44 -04:00
Josh Price
a9b2fc83df
improvement: Add EctoMigrationDefault protocol and implement defaults (#87) 2022-04-19 00:06:02 -04:00
kernel-io
7675191172
failing custom aggregate test (#82)
Co-authored-by: kernel-io <kernel>
Co-authored-by: Zach Daniel <zach@zachdaniel.dev>
2022-03-09 19:45:06 -05:00
Zach Daniel
efaa7c6cc6 fix: properly handle relationship filter bindings
fix: don't consider fields changed with only source -> name changes
2022-02-14 17:44:17 -05:00
Zach Daniel
97bd185c17 feat: support cast_in_query?/0 and source 2022-02-14 11:39:50 -05:00
Zach Daniel
e6ff1d8b4b fix: fix aggregate/base filters 2022-02-11 16:06:51 -05:00
Zach Daniel
a6577d5175 chore: test enum types 2022-02-09 12:13:11 -05:00
Zach Daniel
cd9701a6ea improvement: support referencing aggregates from aggregate filters
fix: don't select more fields than necessary
2022-02-09 11:49:19 -05:00
Zach Daniel
e2bd3c5aec improvement: support access syntax 2022-02-07 16:48:36 -05:00
Zach Daniel
00d937cfa8 fix: place expressions in the proper order in selects 2022-02-07 15:35:18 -05:00
Zach Daniel
96c70fcaff fix: properly reverse parameters before/after expansion 2022-02-07 15:35:18 -05:00
Zach Daniel
2258e6f749 all green on dynamic refactor 2022-02-07 15:35:18 -05:00
Zach Daniel
5b88f476f2 chore: remove empty test 2021-12-17 13:25:45 -05:00
Zach Daniel
912fab9a96 fix: use CiStringWrapper type in ash_postgres 2021-12-17 13:25:14 -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
af97c549c5 improvement: add custom migration types, and repo level override 2021-11-10 04:18:36 -05:00
Zach Daniel
2fdcea7ef8 improvement: support default on aggregates
chore: update to latest ash patterns for testing
2021-10-25 18:53:34 -04:00
Michael St Clair
4307415cca
handle when no opts are passed to custom index (#72) 2021-09-25 20:02:00 -04:00
Zach Daniel
981f6c8ccd improvement!: update to latest ash/ecto versions w/ parameterized types 2021-09-13 12:58:23 -04:00
Zach Daniel
1eacdc8c2e improvement: update to latest ash 2021-07-25 17:59:37 -04:00
Zach Daniel
7d9d7611cb fix: explicitly set prefix at each level 2021-07-24 16:59:23 -04:00
Zach Daniel
5e5b5f3fc0 fix: interaction w/ attribute and context tenancy 2021-07-24 11:28:58 -04:00
Zach Daniel
85f27337d6 improvement: upgrade ash dep
chore: remove comment
test: add a sort test
2021-07-22 15:23:38 -04:00
Zach Daniel
34a8b5cc5b improvement: add sort + select test 2021-07-22 11:03:40 -04:00
Zach Daniel
9e4fce974f chore: add sort tests 2021-07-21 22:18:56 -04:00
Zach Daniel
be7e2a89bc fix: left_lateral_join for many_to_many aggregates
fix: properly reference nested aggregate fields for join
fix: properly determine fallback table for polymorphic resources
2021-07-05 14:12:21 -04:00
Zach Daniel
f13f31330f fix: properly set aggregate query sources 2021-07-02 12:41:44 -04:00
Zach Daniel
5583270426 improvement: support calculation sorts 2021-06-05 18:13:20 -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
86d9e7e7bd improvement: update to latest ash 2021-05-14 01:20:10 -04:00
Zach Daniel
f0b901173c fix: properly group many_to_many aggregates 2021-05-12 13:17:26 -04:00
Frank Dugan III
7db7944549
refactor: remove references to "side loading" (#66) 2021-05-09 17:37:18 -04:00
Zach Daniel
7911de61a5 improvement: support latest ash/filtering on related aggregates 2021-05-08 23:25:28 -04:00
Zach Daniel
29956794ff improvement: update to latest ash
chore: add aggregate test
chore: small experimental interface change
2021-05-06 17:37:29 -04:00
Zach Daniel
7b37042817 test: more lateral join testing
fix: join to join table in lateral join query
2021-05-04 02:14:24 -04:00
Jeremy Ward
11665e0784
fix: fix fragment processing broken (#64) 2021-05-01 10:05:12 -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
1cce277e7d improvement: support list aggregate 2021-04-26 16:45:47 -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
e9222bebfa fix: include type in references (because it is *not* automatic) 2021-04-19 17:28:00 -04:00
Zach Daniel
1f6621b852 feat: add check_constraints, both for validation and migrations 2021-04-19 14:26:41 -04:00
Zach Daniel
7845126037 test: confirm new behavior 2021-04-13 12:31:14 -04:00
Zach Daniel
4417eaa6a1 improvement: default integers to :bigint
fix: don't explicitly set type in `references`
2021-04-12 14:13:23 -04:00
WolfDan
ac0b18c72b
improvement: primary autoincrement key as bigserial (#54) 2021-04-12 12:30:30 -04:00
Zach Daniel
737a6a5442 improvement: support new ash select feature 2021-04-09 00:53:50 -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
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
b30bf8b821 chore: fix tests 2021-03-21 21:49:29 -04:00
Zach Daniel
ef9ddd9c54 fix: typo in references for multitenancy
fix: `null: true` when attr isn't on all resources for a table
2021-03-02 11:38:12 -05:00
Zach Daniel
eb703efe6f fix: better embedded filters, switch to latest ash 2021-02-24 13:59:49 -05:00
Zach Daniel
33a84e1799 improvement: support latest ash 2021-02-22 23:53:18 -05:00
Zach Daniel
5cb77c757a chore: format + test 2021-02-06 15:52:47 -05:00
Zach Daniel
b800b2c984 chore: format 2021-02-06 15:21:52 -05:00
Zach Daniel
cb6943b233 fix: reference the configured table if set 2021-02-06 15:05:37 -05:00
Zach Daniel
70568c43c0 feat: support polymorphic relationships 2021-02-05 18:59:33 -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
31b6edce4e chore: update moduledocs 2021-01-26 20:37:54 -05:00
Zach Daniel
a0fe984005 chore: add a test app, see if that works 2021-01-26 20:02:53 -05:00
Zach Daniel
7f8aa98f24 improvement: better errors for multitenant unique constraints
fix: un-break the `in` filter type casting code

test: add tests for untested features
2021-01-26 15:07:26 -05:00
Zach Daniel
5b3fd3f144 feat: support latest ash + contains 2021-01-23 22:45:15 -05:00
Zach Daniel
80e63f9067 feat: support fragments
feat: support type casting

feat: update to latest ash to support expressions
2021-01-22 16:47:24 -05:00
Zach Daniel
6eb46231ea chore: fix formatter 2021-01-12 20:53:06 -05:00
zimt28
38bf555867
feat: Add check_migrated option to migration generator (#40) (#43) 2021-01-12 20:47:17 -05:00
Zach Daniel
3ac292617e chore: update tests 2021-01-12 20:27:39 -05:00
Zach Daniel
94289b8454 chore: format 2021-01-12 20:22:28 -05:00
zimt28
a9db1f3601
chore: Update primary keys & formatting (#44) 2021-01-12 20:16:48 -05:00
zimt28
f5d51ecdb0
improvement: Omit field opts if they are default values (#37) 2021-01-09 19:52:19 -05:00
Darren Black
650896a7ea
Make integer serial if generated (#36)
Co-authored-by: Darren Black <darren@ifixsystems.com.au>
2021-01-07 22:53:16 -05:00
Zach Daniel
7af29756fa
feat: retain snapshot history 2021-01-07 00:37:41 -05:00
Zach Daniel
b2428213c7 feat: support latest Ash version 2020-12-28 19:26:04 -05:00
Zach Daniel
e8dde8b2ff feat: support refs on both sides of operators 2020-12-23 14:46:49 -05:00
Zach Daniel
ec03af83b8
fix: access data_layer_query with function 2020-11-02 22:59:51 -05:00
Zach Daniel
03510dae24
feat: multitenancy (#25) 2020-10-28 22:26:45 -04:00
Zach Daniel
b78b391a5a
chore: fix ash support 2020-10-17 19:24:11 -04:00
Zach Daniel
493cfb7754
feat: update to latest ash, trigram filter 2020-10-06 01:39:47 -04:00
Zach Daniel
ed1fe9bd24
fix: document/update migration path logic 2020-09-10 23:47:14 -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
Zach Daniel
ea6e55de96
chore: fix lint issues 2020-06-02 23:29:11 -04:00
Zach Daniel
ceb5b4069f
WIP 2020-01-17 12:24:07 -05:00
Zach Daniel
dc94994ea3
WIP 2019-12-04 09:58:20 -05:00
Zach Daniel
5749aa363c
move datalayer stuff into its own repo 2019-10-06 16:36:18 -04:00