Skip to content

[Issue] Prune triggers after setting database up properly #37304

@m2-assistant

Description

@m2-assistant

This issue is automatically created based on existing pull request: #33092: Prune triggers after setting database up properly


Description

When installing a new module which both installs tables and associated mview indexers, Magento fails to run setup:upgrade successfully.

This is because there is a step within setup:upgrade that's designed to prune old triggers from the database that happens before the new database state is established. The implementation detail of this prune is: remove all the known-good triggers, remove all other triggers, reinstate known-good triggers. It's the last step here that's causing issue. When this step tries to reinstate the "known-good" triggers, it's using the new code and therefore needs the new tables that haven't yet been created.

This pull request is a work-around for the problem described here. A proper fix would be to avoid unsubscribe/resubscribe of triggers within this prune step entirely.

Related Pull Requests

none

Fixed Issues

Manual testing scenarios

  1. Install Magento
  2. Set indexers to "Update by Schedule": php bin/magento indexer:set-mode schedule
  3. Add bug33092.tar.gz with tar xzf bug33092.tar.gz
  4. Enable the module with php bin/magento module:enable Magento_Bug33092
  5. Run php bin/magento setup:upgrade
  6. Witness error message / lack of error

Questions or comments

None

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • All automated tests passed successfully (all builds are green)

Metadata

Metadata

Assignees

Labels

Area: FrameworkComponent: SetupIssue: ConfirmedGate 3 Passed. Manual verification of the issue completed. Issue is confirmedPriority: P1Once P0 defects have been fixed, a defect having this priority is the next candidate for fixing.Progress: doneReported on 2.4.xIndicates original Magento version for the Issue report.Reproduced on 2.4.xThe issue has been reproduced on latest 2.4-develop branch

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions