I have pretty simple code which changes only on column, like:
content = Content
|> Repo.get(1)
content
|> Ecto.Changeset.change(%{ views_count: content.views_count + 1 })
|> Repo.update
I don't want this code to change its views count, but I don't want to touch updated_at
field. How can I do that?
I am not sure I understood the question but this may work:
Content
|> where(id: 1)
|> Repo.update_all(inc: [views_count: 1])