I just try to override db_schema.xml file of a core customer module into my custom module , but there is no success.

I need to remove a constraint defined in customer db_schema.xml file, how may I do that.


  • Could you share the code with overided file path.. – aravind Oct 30 '19 at 4:49
  • @aravind, I just have copied the file from vendor\module-customer\etc\db_schema.xml to my custom moulde <NAMESPACE>\<MODULE>\etc\db_schema.xml and did necessary changes regarding constrants, is any thing else I need to do ? – amit_game Oct 30 '19 at 4:54
  • NO this is the way..Have you run the whitelist command? – aravind Oct 30 '19 at 4:57
  • @aravind, I run command and the changes made I can see their in file, but still no hope. – amit_game Oct 30 '19 at 4:58
  • In which table did you change the constraint?and column name? – aravind Oct 30 '19 at 5:00

After setting disabled="true" to the constraint, run generate whitelist command and upgrade.

<?xml version="1.0"?>
<schema xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    <table name="customer_entity">    
        <constraint xsi:type="unique" referenceId="CUSTOMER_ENTITY_EMAIL_WEBSITE_ID" disabled="true" />        
  • Could you Check now..I have updated the answer.. – aravind Oct 30 '19 at 5:17
  • To simplify your file: for <table>, you only need the name attribute. For the constraint, only xsi:type, referenceId and disable. You don't need to copy all those other attributes. – thedotwriter May 1 '20 at 18:07
  • 1
    Yes @thedotwriter i have updated it.. – aravind May 2 '20 at 4:18
  • Just so people are aware, this only seems to work once the table has been completely removed. Make sure to take a backup of any table you are modifying, DROP <tablename>, setup:upgrade then restore that tables data (if it's something important) – Nathaniel Rogers Aug 26 '20 at 7:16

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.