As far as I can tell from Ecto’s codebase, integers are always mapped as bigint
. If I’m reading this correctly why the EncodeError?
It would be good to know more context about the error. I’ve seen this error before, when trying to find an entity by id, passing a bad value.
Example: trying to get user by id, passing a number bigger than max integer.
Ecto, yes, but db… no.
You should show your migration file, and change to the appropriate db type
Thank you both for your observations
The figure “277654884471” is the result of a calculation. In both the migration and schema this figure is assigned the datatype :integer
. What data type should be used instead?
:bigint is the type You are looking for.
UPDATE: I forgot to mention it’s for the migration file, but @benwilson512 did it for me
:bigint
in the migration, :integer
in the schema. The migration is about the database types, and the schema is about the Elixir type.
Thank you everyone for your kind and timely assistance!