-
-
Notifications
You must be signed in to change notification settings - Fork 118
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Code of Conduct
- I agree to follow this project's Code of Conduct
AI Policy
- I agree to follow this project's AI Policy, or I agree that AI was not used while creating this issue.
Versions
ash_postgres 2.6.23
Ash 3.7.6
ash_json_api last commit of main of the repo
Operating system
mac os
Current Behavior
Before updating ash_postgres and ash_sql my code works but after updating it happens
Error 500
00:02:36.391 request_id=GG_-ozua8gyib3wAAIUh [warning] `7f3fccc0-7eec-4370-a0f0-f0ae3ed4c246`: AshJsonApi.Error not implemented for error:
** (Ash.Error.Unknown.UnknownError) ** (Postgrex.Error) ERROR 42804 (datatype_mismatch) column "archived_at" is of type timestamp without time zone but expression is of type text
query: UPDATE "sites" AS s0 SET "updated_at" = s1."__new_updated_at", "archived_at" = s1."__new_archived_at" FROM (SELECT ss0."id" AS "id", (CASE WHEN NOT (ss0."archived_at"::timestamp IS NULL) THEN $1::timestamp ELSE ss0."updated_at"::timestamp END) AS "__new_updated_at", NULL AS "__new_archived_at" FROM "sites" AS ss0 WHERE (ss0."id"::uuid = $2::uuid) AND (NOT (ss0."archived_at"::timestamp IS NULL)) LIMIT $3) AS s1 WHERE (s0."id" = s1."id") RETURNING s0."id", s0."name", s0."host", s0."priority", s0."active", s0."mode", s0."frontend_domain", s0."allowed_origins", s0."master", s0."inserted_at", s0."updated_at", s0."archived_at"
hint: You will need to rewrite or cast the expression.
(ecto_sql 3.13.2) lib/ecto/adapters/sql.ex:1098: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql 3.13.2) lib/ecto/adapters/sql.ex:996: Ecto.Adapters.SQL.execute/6
(ecto 3.13.3) lib/ecto/repo/queryable.ex:241: Ecto.Repo.Queryable.execute/4
(ash_postgres 2.6.23) lib/data_layer.ex:1591: AshPostgres.DataLayer.update_query/4
(ash 3.7.6) lib/ash/actions/update/bulk.ex:614: Ash.Actions.Update.Bulk.do_atomic_update/5
(ash 3.7.6) lib/ash/data_layer/data_layer.ex:470: anonymous fn/3 in Ash.DataLayer.transaction/5
(mishka_cms 0.0.1) lib/mishka_cms/repo.ex:2: anonymous fn/1 in MishkaCms.Repo."transaction (overridable 1)"/2
(ecto 3.13.3) lib/ecto/repo/transaction.ex:7: anonymous fn/2 in Ecto.Repo.Transaction.transact/4
(ecto_sql 3.13.2) lib/ecto/adapters/sql.ex:1458: anonymous fn/3 in Ecto.Adapters.SQL.checkout_or_transaction/4
(db_connection 2.8.1) lib/db_connection.ex:1753: DBConnection.run_transaction/4
(ash 3.7.6) lib/ash/actions/update/bulk.ex:280: Ash.Actions.Update.Bulk.run/6
(ash_json_api 1.4.45) lib/ash_json_api/controllers/helpers.ex:404: anonymous fn/2 in AshJsonApi.Controllers.Helpers.update_record/2
(ash_json_api 1.4.45) lib/ash_json_api/controllers/patch.ex:24: AshJsonApi.Controllers.Patch.call/2
(mishka_cms 0.0.1) deps/plug/lib/plug/router.ex:246: anonymous fn/4 in MishkaCmsWeb.AshJsonApiRouter.dispatch/2
(telemetry 1.3.0) /Users/shahryar/Desktop/mishka_cms/deps/telemetry/src/telemetry.erl:324: :telemetry.span/3
(mishka_cms 0.0.1) deps/plug/lib/plug/router.ex:242: MishkaCmsWeb.AshJsonApiRouter.dispatch/2
(mishka_cms 0.0.1) lib/mishka_cms_web/ash_json_api_router.ex:1: MishkaCmsWeb.AshJsonApiRouter.plug_builder_call/2
(phoenix 1.8.1) lib/phoenix/router/route.ex:55: Phoenix.Router.Route.call/2
(phoenix 1.8.1) lib/phoenix/router.ex:416: Phoenix.Router.__call__/5
(mishka_cms 0.0.1) lib/mishka_cms_web/endpoint.ex:1: MishkaCmsWeb.Endpoint.plug_builder_call/2
Reproduction
My resource:
archive do
# base_filter? false
exclude_read_actions [:archived, :get_archived, :get_any]
exclude_destroy_actions [:permanent_destroy]
end
read :archived do
description "Lists all archived sites for bulk recovery management"
pagination offset?: true, default_limit: 100
filter expr(not is_nil(archived_at))
end
update :unarchive do
accept []
change set_attribute(:archived_at, nil)
atomic_upgrade_with :archived
description "Restores archived site to active status, enabling modifications"
endExpected Behavior
For testing I downgrade my ash_sql to {:ash_sql, "0.3.7", override: true}, and it works without problem
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working