You could use update_all.
I’m not sure about the syntax (and the field names are not right) but as a starting point you could try this from u in User |> Repo.update_all(set: [data_info: u.file])
Thanks a lot! I really appreciate it!
Yes, I am on Postgres.
I’ve tried that approach, and got this:
10:28:09.217 [debug] QUERY ERROR source="users" db=0.0ms queue=121.8ms idle=773.7ms
UPDATE "users" AS b0 SET "data_info" = jsonb_set(b0."data_info", '{data_file}', b0."file") []
** (Postgrex.Error) ERROR 42883 (undefined_function) function jsonb_set(json, unknown, character varying) does not exist
query: UPDATE "users" AS b0 SET "data_info" = jsonb_set(b0."data_file", '{file}', b0."file")
hint: No function matches the given name and argument types. You might need to add explicit type casts.
(ecto_sql) lib/ecto/adapters/sql.ex:593: Ecto.Adapters.SQL.raise_sql_call_error/1
(ecto_sql) lib/ecto/adapters/sql.ex:526: Ecto.Adapters.SQL.execute/5
I am sorry, but I am not very familiar with SQL commands. Appreciate any help here!