Have you tried Renaming the Vendor/Module name with different cases For instance: Vendor_Module to VENDOR_Module?

After renaming the module name I tried to setup:upgrade, but got the below issue,

Integrity constraint violation: 1062 Duplicate entry 'VENDOR_Module' for key 'PRIMARY', query was: INSERT INTO setup_module (module, schema_version) VALUES (?, ?)

Yes, we can manually remove the module from setup_module table and rerun the setup. However, there are many using this module. Is there any dynamic solution to this?

P.S: This pertains only to the custom module I have created and not the core modules

  • 1
    It's not recommended to do that and I do not know what purpose you're doing but anyhow if you suppose to modifying any vendor modules then there would be relationship between one another @Haritha – Prathap Gunasekaran Aug 20 '19 at 10:33
  • it's forbidden to modify the core of Magento, supposing tomorrow you have a Magento patch to set up that update that module, how are you going to do ? – PЯINCƏ Aug 20 '19 at 14:02
  • Renaming a module will not fix the issue you are having as i am assuming your on a Linux based server, if that is the case Linux is not case sensitive like windows is so it doesn't matter which case its in it will always read it as the same. if you want the module name to be changed to the only way to do this would be to literally rename it to something different but not recommended as you would need to rename all the namespaces i think your best option would be to remove it from the setup_modules and run bin/magento setup:upgrade. never a good idea to mess with the vendor folder either. – Dava Gordon Aug 20 '19 at 22:04
  • To be clear I am not referring this to the core Magento module. I am referring to the custom module that I have created. This situation occurs when there is another developer using the same vendor name with different case hence we need to bring it under the same vendor folder. @DavaGordon, yes removing it from the setup_module table is feasible, but here comes the situation that there is more than 2 Magento instance uses this module. Hence I am trying to figure out if there is any dynamic way to overcome this. – Haritha Aug 21 '19 at 5:38
  • If you want to keep the same vendor folder but different module inside you could change all the name spaces in the vendor/yourmodule to vendor/youmodule2 and make sure you change the directory also – Dava Gordon Aug 21 '19 at 6:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.