Can you "undo" a data patch? | Can You Explain It? Knowledge Bite

Опубликовано: 27 Март 2026
на канале: SwiftOtter: eCommerce, B2B and AI
366
13

❓You are working on the Magento 2 module on your development machine. You have created a data patch inside MyModule/Setup/Patch/Data/MyPatch.php to insert default data into the module-specific table. After making the changes, you found a mistake in the data. You updated the patch and ran the setup: upgrade command, but the data is still not modified in the tables. How do you solve this problem?

ℹ️ "Undo" a data patch.
Locally, delete the entry in the patch_list table.
In production, create a new data patch.
If the problem is local, these patches are stored in the above table. Delete this entry, re-run the setup processes and the patch will be re-installed. If this is already in production, a new data patch will ensure this change is synchronized across all environments.
---
Connect with Joseph:
LinkedIn:   / maxwelljoseph  
Twitter:   / swiftotter_joe  

https://swiftotter.com
  / swift_otter  
  / swiftotterinc  

Have you joined the free SwiftOtter Slack community? It's exploding and we don't want you to miss out. Go to https://swiftotter.com/slack to join for free and get plugged into what might be the best group of collaborating developers around!