My Mautic version is: v2.16.0
My PHP version is: 7.2.27
Custom field limit
My problem is: to add custom fields i have to add mare then 200 custom field and when i reached to 110 it give error that (You have reached the limit of custom field allowed in your database)
Mautic creates additional custom fields as columns in the leads table, and MySQL imposes a limit on how many columns or bytes of data there can be in a particular row. Wonder if upgrading to MySQL 8.0 from MySQL 5.7 would expand the number of columns possible.
There is an extended field plugin that is mentioned in this linked issue, which may help for your particular use case.
I came accross this problem today and the extended fields plugin doesn’t work properly with 4.1. anymore.
Also I needed a specific action which was introduced in Mautic 4.1 - send email to user with token support. This is not possible if the token would be one from the extended fields plugin - because the token alias gets looked up inside the “lead” table and not inside “lead fields” table.
I took a deeper look into the actual problem in the database:
Text fields get inserted into the database as “varchar” and the character number -
system fields are defined as varchar with 191 characters
new text customfields are varchar with 255 characters
The mysql limitation is that a table can not exceed 65,535-byte row size.
This means you can create as many fields until you hit the 65,535-bytes.
Therefor you can:
change the varchar characters to the actually needed size:
(i.e if you only need the words red or blue you could limit the characters to 4 - because blue has only 4 characters)
or you change the fields to text instead of varchar - but this makes them non-indexable - means the search for something in the database gets a lot slower.
I changed most of my fields to a varchar character value of 99 or 49
after i did that with almost 100 fields I was able to insert all the other fields I needed
As @mikew described you could just use the “alter table” sql to change a field.
The easiest way would be to simply open the database in phpmyadmin or adminer > navigate to the table lead_fields and change the values there.