Skip to content

Conversation

@tr33m4n
Copy link
Contributor

@tr33m4n tr33m4n commented Jul 2, 2025

#135

Description

Disable foreign key checks when truncating the reservation table. Issue reports inability to setup a project due to a foreign key constraint in a 3rd party module against the inventory_reservation table. Although we can't support every 3rd party module, disabling foreign key constraints when truncating seems like a suitable catchall

Checklist

  • Pull request has a meaningful description of its purpose, include affected Magento versions if it is a bug.
  • All commits are accompanied by meaningful commit messages
  • Tests have been ran / updated (see ./dev/README.md for how to run tests)

@tr33m4n tr33m4n self-assigned this Jul 2, 2025
@tr33m4n tr33m4n linked an issue Jul 2, 2025 that may be closed by this pull request
@chickenland chickenland requested a review from Copilot July 2, 2025 14:59
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request aims to ensure the reservation table can be truncated without foreign key constraint errors by wrapping the operation in a setup context.

  • Added startSetup() and endSetup() calls around the truncation process.
  • Targets the RemoveExistingReservations schema patch to adjust setup behavior.
Comments suppressed due to low confidence (1)

src/Setup/Patch/Schema/RemoveExistingReservations.php:33

  • Add a test to verify that foreign key checks are properly disabled and re-enabled when truncating the reservation table to prevent future regressions.
        $this->setup->endSetup();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot truncate a table referenced in a foreign key constraint

2 participants