I am getting the following error while trying to transfer money from account one to account two using ash_double_entry
package.
I have installed ash_money
package and migrated as per the guide but I am still getting this error. Kindly assist.
:error,
%Ash.Error.Unknown{
changeset: "#Changeset<>",
errors: [
%Ash.Error.Unknown.UnknownError{
error: "** (FunctionClauseError) no function clause matching in Postgrex.DefaultTypes.\"-inlined-Elixir.Postgrex.Extensions.Numeric/1-\"/1",
field: nil,
splode: Ash.Error,
bread_crumbs: [],
vars: [],
path: [],
stacktrace: #Splode.Stacktrace<>,
class: :unknown
}
]
}}
This looks pretty strange, and is not something I experience in my own applications
If you could please create a small project that reproduces the issue, I will investigate.
The issue could be with the extension migrations, because I quickly set up a new project and it worked. I will keep investigating, once I find the solution I will share it here.
It is clear that there’s a numeric Type Ash expect from the DB, it is not getting.
This looks lower down, in Ecto/postgrex. If you can’t reproduce in a normal setup, I can only assume there is something special about your existing setup. Perhaps you can try upgrading postgrex, Ecto, ecto_sql etc.? What version of Postgres are you on?
The issue was in the migrations. To solve it I did the following.
- I created a small project and added
ash_double_entry
.
- Then, I added all resources and domain as per documentation.
Account
, Transfer
, Balance
resources and Ledger
domain.
- I generated migrations using
mix ash_postgres.generate_mistions --name add_ash_double_entry_tables
- Tested the new project and confirmed all is well.
- Then I replaced ash_double_entry table in the project with issues with the small project migrations:
xxxxx_install_4_extensions.exs
and xxxxxx_add_double_entry_tables
migrations.
Note that I did some edit so that the migration won’t conflict with the existing ones
This gist contains the migrations that solved the problem.
1 Like
Alternatively, to solve this, you can just drop all migrations and generate migration afresh with the latest package versions. It should work as well.
1 Like