details: https://code.openbravo.com/erp/devel/pi/rev/46a06da3a17a changeset: 35509:46a06da3a17a user: Atul Gaware <atul.gaware <at> openbravo.com> date: Fri Mar 01 13:37:14 2019 +0530 summary: Related To Issue 39328:Analytics should not have referential integrity with transactional data
** Add tables to white list to avoid fk checks to avoid warnings during export database task obanaly_fact_discounts, obanaly_fact_order, obanaly_fact_salesordheader, obretan_fact_sessions and obdpl_fact_acct_pl ** Added existing ignored table ad_module_install in the white list diffstat: src/org/openbravo/service/system/DatabaseValidator.java | 24 ++++++++++++++-- 1 files changed, 20 insertions(+), 4 deletions(-) diffs (61 lines): diff -r c5133206f8ce -r 46a06da3a17a src/org/openbravo/service/system/DatabaseValidator.java --- a/src/org/openbravo/service/system/DatabaseValidator.java Mon Mar 04 16:41:53 2019 +0100 +++ b/src/org/openbravo/service/system/DatabaseValidator.java Fri Mar 01 13:37:14 2019 +0530 @@ -11,7 +11,7 @@ * under the License. * The Original Code is Openbravo ERP. * The Initial Developer of the Original Code is Openbravo SLU - * All portions are Copyright (C) 2009-2018 Openbravo SLU + * All portions are Copyright (C) 2009-2019 Openbravo SLU * All Rights Reserved. * Contributor(s): ______________________________________. ************************************************************************ @@ -374,15 +374,17 @@ SystemValidationResult result) { final Entity entity = ModelProvider.getInstance().getEntityByTableName(table.getName()); List<String> fkWhiteList = getFkWhiteList(); + List<String> fKTblWhiteList = getFkTblWhiteList(); if (entity == null) { // can happen with mismatches return; } - if (entity.getTableName().equalsIgnoreCase("Ad_Module_Install")) { - // We shouldn't check the foreign keys of the Ad_Module_Install table, as this one is special, - // and doesn't need fks + + if (fKTblWhiteList.contains(entity.getTableName().toLowerCase())) { + // ignore fk check for the tables in the tableFKWhiteList return; } + for (Property property : entity.getProperties()) { // ignore computed columns @@ -408,6 +410,7 @@ } // ignore ad_audit_trail as fk's are omitted on purpose + if (entity.getTableName().equalsIgnoreCase("ad_audit_trail")) { continue; } @@ -452,6 +455,19 @@ return fkWhiteList; } + // Get List of Tables for which Foreign Keys to be skipped in the validation while exporting + // database. + private List<String> getFkTblWhiteList() { + List<String> fkTblWhiteList = new ArrayList<String>(); + fkTblWhiteList.add("ad_module_install"); + fkTblWhiteList.add("obanaly_fact_discounts"); + fkTblWhiteList.add("obanaly_fact_order"); + fkTblWhiteList.add("obanaly_fact_salesordheader"); + fkTblWhiteList.add("obretan_fact_sessions"); + fkTblWhiteList.add("obdpl_fact_acct_pl"); + return fkTblWhiteList; + } + private void matchColumns(Table adTable, org.apache.ddlutils.model.Table dbTable, SystemValidationResult result) { _______________________________________________ Openbravo-commits mailing list Openbravo-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openbravo-commits