Your software
My Mautic version is: 5.2.1
My PHP version is: 8.1
My Database type and version is: MariaDB 10.3
Your problem
My problem is:
I found the issue after upgrading to 4.4.5.
I still managed to upgrade to 5.2.1 but the error output persist.
I get two errors,:
When running console doctrine:schema:update --force
I get:
Can't DROP INDEX
IDX_1AE3441319EB6921; check that it exists.
When validate console php bin/console doctrine:schema:validate
I get:
The entity-class Mautic\DynamicContentBundle\Entity\DynamicContentLeadData mapping is invalid:
These errors are showing in the log:
-
SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP INDEX
IDX_1AE3441319EB6921
; check that it exists -
The entity-class Mautic\DynamicContentBundle\Entity\DynamicContentLeadData mapping is invalid:
Steps I have tried to fix the problem:
-
Check type, and length
Checked the db that I checked that the client_id in oauth2_user_client_xref matched the id in oauth2_clients. Both was of length 10. -
Search for the key
Search the db for the key, if it was in other table than oauth2_user_client_xref.
It was not
SELECT TABLE_SCHEMA, TABLE_NAME, INDEX_NAME, COLUMN_NAME
FROM INFORMATION_SCHEMA.STATISTICS
WHERE INDEX_NAME = ‘IDX_1AE3441319EB6921’;
Gives:
Empty set
- Invalid name
I also checked if they key had a typo or something
Here is how oauth2_user_client_xref looks:
| Table | Non_unique | Key_name | Seq_in_index | Column_name
| oauth2_user_client_xref | 0 | PRIMARY | 1 | client_id
| oauth2_user_client_xref | 0 | PRIMARY | 2 | user_id
| oauth2_user_client_xref | 1 | IDX_1AE34413A76ED395 | 1 | user_id
- VALIDATE OUTPUT
To check what commands that were run:
sudo php /bin/console doctrine:schema:validate -vv
Here is the validate output, and the first index to be dropped is the IDX_1AE3441319EB6921.
ERROR OUTPUT
Mapping
[FAIL] The entity-class Mautic\DynamicContentBundle\Entity\DynamicContentLeadData mapping is invalid:
- The association Mautic\DynamicContentBundle\Entity\DynamicContentLeadData#dynamicContent refers to the inverse side field Mautic\DynamicContentBundle\Entity\DynamicContent#id which is not defined as association.
- The association Mautic\DynamicContentBundle\Entity\DynamicContentLeadData#dynamicContent refers to the inverse side field Mautic\DynamicContentBundle\Entity\DynamicContent#id which does not exist.
Database
[ERROR] The database schema is not in sync with the current mapping file.
// 103 schema diff(s) detected:
DROP INDEX IDX_1AE3441319EB6921 ON oauth2_user_client_xref;
DROP INDEX IDX_6480052EF639F774 ON campaign_leadlist_xref;
DROP INDEX IDX_3048A8B2F639F774 ON campaign_form_xref;
DROP INDEX IDX_5995213DF639F774 ON campaign_leads;
DROP INDEX IDX_2E24F01CA832C1C9 ON email_list_xref;
DROP INDEX IDX_3D3C217BA832C1C9 ON email_list_excluded;
DROP INDEX IDX_CA315778A832C1C9 ON email_assets_xref;
ALTER TABLE email_stats_devices DROP FOREIGN KEY FK_7A8A1C6FA03F5E9F;
ALTER TABLE email_stats_devices ADD CONSTRAINT FK_7A8A1C6FA03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
ALTER TABLE email_stats DROP FOREIGN KEY FK_CA0A2625A03F5E9F;
ALTER TABLE email_stats ADD CONSTRAINT FK_CA0A2625A03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
ALTER TABLE form_fields CHANGE validation validation LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', CHANGE conditions conditions LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)', CHANGE parent_id parent_id VARCHAR(191) DEFAULT NULL;
ALTER TABLE form_submissions DROP FOREIGN KEY FK_C80AF9E6A03F5E9F;
ALTER TABLE form_submissions CHANGE ip_id ip_id INT UNSIGNED DEFAULT NULL;
ALTER TABLE form_submissions ADD CONSTRAINT FK_C80AF9E6A03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
ALTER TABLE sync_object_mapping CHANGE internal_storage internal_storage LONGTEXT NOT NULL COMMENT '(DC2Type:json)';
DROP INDEX country_search ON leads;
DROP INDEX city_search ON leads;
DROP INDEX state_search ON leads;
DROP INDEX address1_search ON leads;
DROP INDEX timezone_search ON leads;
DROP INDEX zipcode_search ON leads;
DROP INDEX address2_search ON leads;
DROP INDEX last_active_search ON leads;
ALTER TABLE leads CHANGE fax fax VARCHAR(191) DEFAULT NULL, CHANGE preferred_locale preferred_locale VARCHAR(191) DEFAULT NULL, CHANGE website website VARCHAR(191) DEFAULT NULL, CHANGE facebook facebook VARCHAR(191) DEFAULT NULL, CHANGE foursquare foursquare VARCHAR(191) DEFAULT NULL, CHANGE instagram instagram VARCHAR(191) DEFAULT NULL, CHANGE linkedin linkedin VARCHAR(191) DEFAULT NULL, CHANGE skype skype VARCHAR(191) DEFAULT NULL, CHANGE twitter twitter VARCHAR(191) DEFAULT NULL;
CREATE INDEX website_search ON leads (website);
ALTER TABLE lead_ips_xref DROP FOREIGN KEY FK_9EED7E66A03F5E9F;
DROP INDEX IDX_9EED7E6655458D ON lead_ips_xref;
ALTER TABLE lead_ips_xref ADD CONSTRAINT FK_9EED7E66A03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE CASCADE;
DROP INDEX IDX_F2E51EB655458D ON lead_tags_xref;
DROP INDEX search_by_object ON lead_fields;
ALTER TABLE lead_fields CHANGE default_value default_value VARCHAR(191) DEFAULT NULL, CHANGE is_index is_index TINYINT(1) DEFAULT NULL;
DROP INDEX companyemail_search ON companies;
DROP INDEX companyindustry_search ON companies;
DROP INDEX companyzipcode_search ON companies;
DROP INDEX companyphone_search ON companies;
DROP INDEX companyaddress1_search ON companies;
DROP INDEX companycountry_search ON companies;
DROP INDEX companycity_search ON companies;
DROP INDEX companyaddress2_search ON companies;
DROP INDEX companyname_search ON companies;
DROP INDEX companystate_search ON companies;
ALTER TABLE companies CHANGE companywebsite companywebsite VARCHAR(191) DEFAULT NULL, CHANGE companyfax companyfax VARCHAR(191) DEFAULT NULL;
ALTER TABLE imports CHANGE properties properties LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)';
ALTER TABLE lead_event_log CHANGE properties properties LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)';
DROP INDEX IDX_F5F47C7CB9FC8874 ON lead_lists_leads;
ALTER TABLE lead_points_change_log DROP FOREIGN KEY FK_949C2CCCA03F5E9F;
ALTER TABLE lead_points_change_log DROP FOREIGN KEY FK_949C2CCCFE54D947;
ALTER TABLE lead_points_change_log CHANGE ip_id ip_id INT UNSIGNED DEFAULT NULL;
ALTER TABLE lead_points_change_log ADD CONSTRAINT FK_949C2CCCA03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
DROP INDEX fk_949c2cccfe54d947 ON lead_points_change_log;
CREATE INDEX IDX_949C2CCCFE54D947 ON lead_points_change_log (group_id);
ALTER TABLE lead_points_change_log ADD CONSTRAINT FK_949C2CCCFE54D947 FOREIGN KEY (group_id) REFERENCES point_groups (id) ON DELETE CASCADE;
ALTER TABLE contact_export_scheduler DROP FOREIGN KEY FK_1483A5E9A76ED395;
ALTER TABLE contact_export_scheduler DROP FOREIGN KEY FK_1483A5E9A76ED395;
ALTER TABLE contact_export_scheduler CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL, CHANGE user_id user_id INT UNSIGNED DEFAULT NULL;
ALTER TABLE contact_export_scheduler ADD CONSTRAINT FK_AC0A03CA76ED395 FOREIGN KEY (user_id) REFERENCES users (id) ON DELETE CASCADE;
DROP INDEX fk_1483a5e9a76ed395 ON contact_export_scheduler;
CREATE INDEX IDX_AC0A03CA76ED395 ON contact_export_scheduler (user_id);
ALTER TABLE contact_export_scheduler ADD CONSTRAINT FK_1483A5E9A76ED395 FOREIGN KEY (user_id) REFERENCES users (id);
DROP INDEX IDX_F4190AB6979B1AD6 ON companies_leads;
DROP INDEX dnc_channel_id_search ON lead_donotcontact;
ALTER TABLE push_notification_stats DROP FOREIGN KEY FK_DE63695EA03F5E9F;
ALTER TABLE push_notification_stats ADD CONSTRAINT FK_DE63695EA03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
DROP INDEX IDX_473919EFEF1A9D84 ON push_notification_list_xref;
DROP INDEX IDX_2F81A41DB42D874D ON channel_url_trackables;
ALTER TABLE video_hits DROP FOREIGN KEY FK_1D1831F7A03F5E9F;
ALTER TABLE video_hits CHANGE ip_id ip_id INT UNSIGNED DEFAULT NULL;
ALTER TABLE video_hits ADD CONSTRAINT FK_1D1831F7A03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
ALTER TABLE page_hits DROP FOREIGN KEY FK_9D4B70F1A03F5E9F;
ALTER TABLE page_hits CHANGE ip_id ip_id INT UNSIGNED DEFAULT NULL;
ALTER TABLE page_hits ADD CONSTRAINT FK_9D4B70F1A03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
ALTER TABLE point_lead_action_log DROP FOREIGN KEY FK_6DF94A56A03F5E9F;
DROP INDEX IDX_6DF94A56C028CEA2 ON point_lead_action_log;
ALTER TABLE point_lead_action_log ADD CONSTRAINT FK_6DF94A56A03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
DROP INDEX IDX_9D85A703E7A1254A ON point_group_contact_score;
ALTER TABLE point_group_contact_score DROP FOREIGN KEY FK_9D85A703FE54D947;
DROP INDEX fk_9d85a703fe54d947 ON point_group_contact_score;
CREATE INDEX IDX_9D85A703FE54D947 ON point_group_contact_score (group_id);
ALTER TABLE point_group_contact_score ADD CONSTRAINT FK_9D85A703FE54D947 FOREIGN KEY (group_id) REFERENCES point_groups (id) ON DELETE CASCADE;
ALTER TABLE point_triggers DROP FOREIGN KEY FK_9CABD32FFE54D947;
DROP INDEX fk_9cabd32ffe54d947 ON point_triggers;
CREATE INDEX IDX_9CABD32FFE54D947 ON point_triggers (group_id);
ALTER TABLE point_triggers ADD CONSTRAINT FK_9CABD32FFE54D947 FOREIGN KEY (group_id) REFERENCES point_groups (id) ON DELETE CASCADE;
ALTER TABLE points DROP FOREIGN KEY FK_27BA8E29FE54D947;
DROP INDEX fk_27ba8e29fe54d947 ON points;
CREATE INDEX IDX_27BA8E29FE54D947 ON points (group_id);
ALTER TABLE points ADD CONSTRAINT FK_27BA8E29FE54D947 FOREIGN KEY (group_id) REFERENCES point_groups (id) ON DELETE CASCADE;
ALTER TABLE point_lead_event_log DROP FOREIGN KEY FK_C2A3BDBAA03F5E9F;
DROP INDEX IDX_C2A3BDBA71F7E88B ON point_lead_event_log;
ALTER TABLE point_lead_event_log ADD CONSTRAINT FK_C2A3BDBAA03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
ALTER TABLE reports CHANGE settings settings LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)';
ALTER TABLE sms_message_stats DROP FOREIGN KEY FK_FE1BAE9A03F5E9F;
ALTER TABLE sms_message_stats CHANGE details details LONGTEXT NOT NULL COMMENT '(DC2Type:json)';
ALTER TABLE sms_message_stats ADD CONSTRAINT FK_FE1BAE9A03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
DROP INDEX IDX_B032FC2EBD5C7E60 ON sms_message_list_xref;
ALTER TABLE stage_lead_action_log DROP FOREIGN KEY FK_A506AFBEA03F5E9F;
DROP INDEX IDX_A506AFBE2298D193 ON stage_lead_action_log;
ALTER TABLE stage_lead_action_log ADD CONSTRAINT FK_A506AFBEA03F5E9F FOREIGN KEY (ip_id) REFERENCES ip_addresses (id) ON DELETE SET NULL;
DROP INDEX webhook_id_date ON webhook_queue;
DROP INDEX IDX_45207A4A4CE1C902 ON monitoring_leads;
ALTER TABLE tweet_stats CHANGE response_details response_details LONGTEXT DEFAULT NULL COMMENT '(DC2Type:json)';
ALTER TABLE bundle_grapesjsbuilder CHANGE draft_custom_mjml draft_custom_mjml LONGTEXT DEFAULT NULL;
And here is the migrations:
Other people with similar problem
I have seen this error show up here and there in the support but the threads have been closed without a clear path to solving the issue. Maybe its different problems just same error code but would be great if its figured out.