Copy values from one custom attribute to another

I’ve created a custom attribute and filled it with data for many contacts. Now i found that the ID of the custom attribute was choosen bad but it can’t be changed (in the GUI) afterwards and so i thought to simply create a new one, copy the data over and remove the old one.
But i don’t know how to do this in the Mautic GUI? Maybe there is a way to do it in the SQL-DB?

Custom fields are stored as table columns (unless you use a special plugin).
So you would need to read it out and write it in the new place.
Joey

Oh well, that easy?! Ok, i found the custom fields are stored as direct accessible columns in the table “leads”. So it simply took:
UPDATE leads SET newfield = oldfield;
and that’s it. Means that adding a custom field involves a schema change in this table.

Did it work :slight_smile:

Oh yes, it did :slight_smile:
I wonder if i could have changed the name of the field instead, in the same easy manner?
Like

ALTER TABLE leads RENAME oldfied TO newfield;