3

I've renamed a custom module from MagicPack_magicheader to MagicPack_Magicheader and trying to now update by running setup:upgrade. I get the following error:

  [Zend_Db_Statement_Exception]                                                                                                                                                                      
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'MagicPack_Magicheader' for key 'PRIMARY', query was: INSERT INTO `setup_module` (`module`, `schema_version`) VALUES (?, ?)  



  [PDOException]                                                                                                   
  SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'MagicPack_Magicheader' for key 'PRIMARY'  

On the site itself, it tells me to run upgrade, but I've noticed two entries:

The following modules are outdated:
MagicPack_Magicheader schema: current version - none, required version - 0.2.0
MagicPack_Magicheader data: current version - none, required version - 0.2.0

This seems to match the issue with duplicate entries. Can anyone let me know why there are duplicate entries, one for schema and one for data? The module.xml file is as follows:

<?xml version="1.0"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="MagicPack_Magicheader" setup_version="0.0.1"/>
</config>

Thanks

9

its easy to fix, follow the instruction

  1. find setup_module table name in database
  2. then find the row which contains the name of your module
  3. delete the row containing the old module only (when you run setup:upgrade it will automatically be re-generated)
  4. run the command bin/magento setup:upgrade

I hope now your get fixed. for any clarification mention in comment

Reason: your old module information already exist, so whenever you run, its get conflict.After removing old module information its successfully get upgrade.

have good luck.

  • welcome @MichaelWatson – Bilal Usean Apr 23 '16 at 12:04
  • This is incomplete - what do you do when you find 'setup_module'? – ol'bob dole Aug 1 '17 at 19:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.