Why store ecto_arc field in database?

I am little bit confused about arc and ecto_arc using with phoenix. Suppose I have a schema “User” and it has avatar pic. Do I really need to create avatar string field or can I just get away with naming file consistently using id or uuid, ex.

  def filename(version, {_, scope}) do
    "avatar_#{scope.uuid}"
  end

def storage_dir(version, {file, scope}) do
  "uploads/images/#{scope.uuid}/"
end

It works but I am not sure it its best pratice. Also I have added boolean column (avatar_uploaded) to track if avatar is uploaded. I understand that boolean uses very few bytes compared to storing string and for a model with like million records this can really save some space. So should I do it? What pitfalls am I digging for myself?

1 Like