Bigint Datatype not Accepting in Schema

In the migration file, I included the offer_id field, assigning it the bigint datatype. After ecto.migrate, the columns created on the database.

Next, I included the offer_id field with the bigint datatype. It’s Throwing this Error
** (ArgumentError) unknown type :bigint for field :offer_id
(ecto 3.9.6) lib/ecto/schema.ex:2281: Ecto.Schema.check_field_type!/4
(ecto 3.9.6) lib/ecto/schema.ex:1919: Ecto.Schema.field/4
lib/db_test/inventory/product.ex:11: (module

Did I make a mistake, or is there an issue with the Elixir code?
What is the solution to this issue?
Thanks! :smiley:

The field macro in a schema takes an “ecto type” (docs), not an “database type”. :bigint is a database type, not an ecto type – ecto doesn’t deal with the usual size constraints of databases. You’d want to use :integer in the schema.

2 Likes

Thank you for providing the solution and a clear explanation. :+1: :+1: