Repo.update returns duplicate field .?

I am trying to build changeset and update.

Here is the changeset

  action: nil,
  changes: %{
    account: "account number",
    avaliable_phone_number_count: 1,
    msid: "msid",
    token: "token"
  errors: [],
  data: #Texting.Messenger.Twilio<>,
  valid?: true

then I did
{:ok, twilio} = changeset |> Repo.update

and inspecting twilio struct

it returns this

  __meta__: #Ecto.Schema.Metadata<:loaded, "twilio">,
  __struct__: Texting.Messenger.Twilio,
  account: "ACe7d56cca24c1bc1284326e189265d3f5",
  available_phone_number_count: 0,
  avaliable_phone_number_count: 1,
  id: 16,
  msid: "MGf74dfb6e395133821d9b338cfd06c645",
  token: "7546e947a87033e84df8933464d92089",
  user: #Ecto.Association.NotLoaded<association :user is not loaded>,
  user_id: 48

why is there two same field(available_phone_number_count)? what is the problem?
and it didn’t update only that field in database.

in my console, I can find this

[debug] QUERY OK db=0.7ms
UPDATE "twilio" SET "account" = $1, "msid" = $2, "token" = $3 WHERE "id" = $4 ["account number", "msid", "token", 16]

available_phone_number_count field doesn’t show up in update query…

available vs. avaliable

1 Like

Look closer: avaliable vs available.

1 Like