I think that the culprit of all these bad database issues is the generated_email_domain column that I have not idea who puts in there or who is using it, but I went and dropped this table, then I was able to add more custom fields and also drop other unwanted columns inside the mautic database.
@rcheesley - any idea what this column is, who is creating it and why ? and what happens if I drop it ?
Are you able to access your MySQL database ? If so I would suggest following my directions above - alter table leads drop column generated_email_domains (or something like that, not in front of computer).
After I did this everything continued working and I was able to create new custom fields.
By the way I would strongly suggest doing a dump of your database before doing this.
Mysqldump -u username database_name -pPassword | gzip > Mautic-db-backup-date.sql.gz
I don’t think it will break anything if you remove that column but I suggest to leave it there. It will be created again when you run migrations during next Mautic upgrade.
The generated field basically takes the email address of the contact in the “email” column and takes the domain name after the “@”. Then you can use that value in segment filters which is much faster than other methods. It’s MySql feature so Mautic does not have to care about keeping this field up to date. MySql does it for us.
Can you please confirm that you have the “email” column in the “leads” table? The error suggests that that column is missing.