# DB update issue: Can't DROP INDEX \`IDX\_1AE3441319EB6921\`; check that it exists

**URL:** <https://forum.mautic.org/t/db-update-issue-cant-drop-index-idx-1ae3441319eb6921-check-that-it-exists/34989>\
**Category:** Product Support\
**Created:** [February 9, 2025, 5:07pm UTC](https://forum.mautic.org/t/db-update-issue-cant-drop-index-idx-1ae3441319eb6921-check-that-it-exists/34989 "2025-02-09T17:07:09Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fkrafft](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/fkrafft/32/2220_2.png) [@fkrafft](https://forum.mautic.org/u/fkrafft)\
**Post date:** [February 9, 2025, 5:07pm UTC](https://forum.mautic.org/t/db-update-issue-cant-drop-index-idx-1ae3441319eb6921-check-that-it-exists/34989/1 "2025-02-09T17:07:09Z")

</div>

**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:**

1. SQLSTATE[42000]: Syntax error or access violation: 1091 Can’t DROP INDEX `IDX_1AE3441319EB6921`; check that it exists

2. The entity-class Mautic\DynamicContentBundle\Entity\DynamicContentLeadData mapping is invalid:

**Steps I have tried to fix the problem:**

1. **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.

2. **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

1. **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

1. **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:**

 ![image](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/1/151a95c8cbba87bbeb9aa0f240049af5bdbc1abf.png)

**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.

> [@Outstanding queries after upgrade to 4.4.5](https://forum.mautic.org/t/outstanding-queries-after-upgrade-to-4-4-5/26884/8):
>
> Any update on the “right way” to handle these table references? And FYI, I have similar problem on a 4.4.13. I checked that the client\_id in oauth2\_user\_client\_xref matched the id in oauth2\_clients. And they are of the same type and length. DESCRIBE oauth2\_clients; ±--------------------±-----------------±-----±----±--------±---------------+ | Field | Type | Null | Key | Default | Extra | ±--------------------±-----------------±-----±----±--------±-----…

> [@Installing Fresh Copy of 4.3.1, Still has Mysql Bugs](https://forum.mautic.org/t/installing-fresh-copy-of-4-3-1-still-has-mysql-bugs/24434/4):
>
> Before you ran the migrations did you check the status of migrations after fresh install.

> <https://github.com/mautic/mautic/issues/13845>
>
> \### Mautic Version
> 
> 5.1.x series
> 
> \### Way of installing
> 
> I installed with …composer using https://github.com/mautic/recommended-project
> 
> \### PHP version
> 
> 8.1.29
> 
> \### What browsers are you seeing the problem on?
> 
> Not relevant
> 
> \### What happened?
> 
> When try to run bin/console doctrine:schema:update --no-interaction --force i got errors.
> 
> 
> \### How can we reproduce this issue?
> 
> Edited composer.json - changing 5.0.4 to 5.1, then
> composer update --with-dependencies
> bin/console cache:clear
> bin/console mautic:update:apply --finish
> bin/console doctrine:migration:migrate --no-interaction
> bin/console doctrine:schema:update --no-interaction --force
> 
> \### Relevant log output
> 
> \`\`\`shell
> bin/console doctrine:schema:update --no-interaction --force
> 
>                                                                                                                         
> \[WARNING\] Not passing the "--complete" option to "doctrine:schema:update" is deprecated and will not be supported when 
> using doctrine/dbal 4                                                                                        
>                                                                                                                         
> 
> Updating database schema...
> 
> 
> In ExceptionConverter.php line 117:
>                                                                                                                                                                  
> An exception occurred while executing a query: SQLSTATE\[42000\]: Syntax error or access violation: 1091 Can't DROP INDEX \`IDX\_1AE3441319EB6921\`; check that it  
> exists                                                                                                                                                        
>                                                                                                                                                                  
> 
> In Exception.php line 28:
>                                                                                                                          
> SQLSTATE\[42000\]: Syntax error or access violation: 1091 Can't DROP INDEX \`IDX\_1AE3441319EB6921\`; check that it exists  
>                                                                                                                          
> 
> In Connection.php line 33:
>                                                                                                                          
> SQLSTATE\[42000\]: Syntax error or access violation: 1091 Can't DROP INDEX \`IDX\_1AE3441319EB6921\`; check that it exists  
>                                                                                                                          
> 
> doctrine:schema:update \[--em EM\] \[--complete\] \[--dump-sql\] \[-f|--force\]
> \`\`\`
> 
> 
> \### Code of Conduct
> 
> \- \[X\] I confirm that I have read and agree to follow this project's Code of Conduct
> 
> \<br /\>\<hr\>
> Care about this issue? Want to get it resolved sooner? If you are a \<a href='https://www.mautic.org/become-a-member-of-mautic'\>member of Mautic\</a\>, you can add some funds to the \<a href='https://opencollective.com/mautic/projects/bounties'\>Bounties Project\</a\> so that the person who completes this task can claim those funds once it is merged by a member of the core team! Read the docs \<a href='https://contribute.mautic.org/product-team/mautic-bounty-programme'\>here.\</a\>
