code: private Collection<String> filter(Collection<String> scripts)
     {
        String JCR_ITEM_PRIMARY_KEY = "CONSTRAINT JCR_PK_" + itemTableSuffix + " PRIMARY KEY(ID)";
        String JCR_ITEM_FOREIGN_KEY =
           "CONSTRAINT JCR_FK_" + itemTableSuffix + "_PARENT FOREIGN KEY(PARENT_ID) REFERENCES " + itemTableName + "(ID)";
  
        String JCR_VALUE_PRIMARY_KEY = "CONSTRAINT JCR_PK_" + valueTableSuffix + " PRIMARY KEY(ID)";
        String JCR_VALUE_FOREIGN_KEY =
           "CONSTRAINT JCR_FK_" + valueTableSuffix + "_PROPERTY FOREIGN KEY(PROPERTY_ID) REFERENCES " + itemTableName
              + "(ID)";
  
        Collection<String> filteredScripts = new ArrayList<String>();
  
        for (String script : scripts)
        {
           if (script.contains(JCR_ITEM_PRIMARY_KEY + ","))
           {
              script = script.replace(JCR_ITEM_PRIMARY_KEY + ",", JCR_ITEM_PRIMARY_KEY);
              script = script.replace(JCR_ITEM_FOREIGN_KEY, "");
           }
           else if (script.contains(JCR_VALUE_PRIMARY_KEY + ","))
           {
              script = script.replace(JCR_VALUE_PRIMARY_KEY + ",", JCR_VALUE_PRIMARY_KEY);
              script = script.replace(JCR_VALUE_FOREIGN_KEY, "");
           }
  
           filteredScripts.add(script);
        }
  
        return filteredScripts;
     }
docs: Removing foreign key creation from initialization scripts for table JCR_S(M)ITEM
  and JCR_S(M)VALUE. It is not possible to create table with such foreign key if the same key
  exists in another table of database