Openbravo Issue Tracking System - Openbravo ERP
View Issue Details
0031712Openbravo ERPY. DBSourceManagerpublic2015-12-15 10:242016-03-17 10:55
AugustoMauch 
AugustoMauch 
normalminorhave not tried
closedfixed 
5
 
3.0PR16Q23.0PR16Q2 
alostale
Core
No
0031712: Open dbsourcemanager API to allow enabling/disabling the foreign keys and constraints of particular tables
The database replication module needs at times to reload the synchronized tables. When a table is reloaded, it needs to drop its foreign keys and constraints to prevent errors when importing.

Currently there are no public methods to do this. In the Platform interface there are methods that do this for the whole database or for a particular dataset, but not one for individual tables.
-
Add to the org.apache.ddlutils.Platform interface methods to enable and disable foreign keys and constraints for individual tables.
No tags attached.
related to defect 0032553 closed AugustoMauch It is not possible to reenable the constraints of a given table 
Issue History
2015-12-15 10:24AugustoMauchNew Issue
2015-12-15 10:24AugustoMauchAssigned To => AugustoMauch
2015-12-15 10:24AugustoMauchModules => Core
2015-12-15 10:24AugustoMauchTriggers an Emergency Pack => No
2015-12-15 10:25AugustoMauchStatusnew => scheduled
2015-12-15 10:25AugustoMauchTarget Version => 3.0PR16Q2
2016-01-04 10:51AugustoMauchSummaryOpen dbsourcemanager API to allow enabling/disabling the foreign keys and constraints of particular tables => Open dbsourcemanager API to allow enabling/disabling the foreign keys, triggers and constraints of particular tables
2016-01-04 10:51AugustoMauchDescription Updatedbug_revision_view_page.php?rev_id=10573#r10573
2016-01-04 10:51AugustoMauchProposed Solution updated
2016-01-25 11:00AugustoMauchSummaryOpen dbsourcemanager API to allow enabling/disabling the foreign keys, triggers and constraints of particular tables => Open dbsourcemanager API to allow enabling/disabling the foreign keys and constraints of particular tables
2016-01-25 11:01AugustoMauchDescription Updatedbug_revision_view_page.php?rev_id=10756#r10756
2016-01-25 11:01AugustoMauchProposed Solution updated
2016-01-29 14:17AugustoMauchReview Assigned To => alostale
2016-01-29 14:24hgbotCheckin
2016-01-29 14:24hgbotNote Added: 0083731
2016-01-29 14:24hgbotStatusscheduled => resolved
2016-01-29 14:24hgbotResolutionopen => fixed
2016-01-29 14:24hgbotFixed in SCM revision => http://code.openbravo.com/erp/devel/dbsm-main/rev/689cf824c775ff478473090d7a0ee1a2f15fa6ab [^]
2016-01-29 14:24hgbotCheckin
2016-01-29 14:24hgbotNote Added: 0083732
2016-01-29 14:32hgbotCheckin
2016-01-29 14:32hgbotNote Added: 0083736
2016-01-29 14:32hgbotFixed in SCM revisionhttp://code.openbravo.com/erp/devel/dbsm-main/rev/689cf824c775ff478473090d7a0ee1a2f15fa6ab [^] => http://code.openbravo.com/erp/devel/pi/rev/b80096ac894321c09bf620700c255fd3ef9f8890 [^]
2016-02-05 09:02alostaleNote Added: 0083950
2016-02-05 09:02alostaleStatusresolved => closed
2016-02-05 09:02alostaleFixed in Version => 3.0PR16Q2
2016-03-17 10:55hudsonbotCheckin
2016-03-17 10:55hudsonbotNote Added: 0085091
2016-03-30 18:26AugustoMauchRelationship addedrelated to 0032553

Notes
(0083731)
hgbot   
2016-01-29 14:24   
Repository: erp/devel/dbsm-main
Changeset: 689cf824c775ff478473090d7a0ee1a2f15fa6ab
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Jan 26 10:39:12 2016 +0100
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/689cf824c775ff478473090d7a0ee1a2f15fa6ab [^]

Fixes issue 31712: Foreign keys and constraints can be disabled per table

Before this change the Platform class only offered methods to disable all the constraints and foreign keys of the whole database. Now it is possible to do it also on a table to table basis.

Changes done:
- Platform.java: Added public methods disableAllFkForTable, enableAllFkForTable, disableCheckConstraintsForTable, enableCheckConstraintsForTable
- PlatformImplBase.java: Provides a functional default implementation for disableCheckConstraintsForTable and enableCheckConstraintsForTable, possible because the .disableAllChecks(table) was already implemented. Also provides an implementation for disableAllFkForTable and enableAllFkForTable that just returns throw new DatabaseOperationException("Error: Operation not supported"), because it needs to be implemented in each specific platform.
- Oracle8Platform and PostgreSqlPlatform: Implementations for disableAllFkForTable and enableAllFkForTable.

---
M src/org/apache/ddlutils/Platform.java
M src/org/apache/ddlutils/platform/PlatformImplBase.java
M src/org/apache/ddlutils/platform/oracle/Oracle8Platform.java
M src/org/apache/ddlutils/platform/postgresql/PostgreSqlPlatform.java
---
(0083732)
hgbot   
2016-01-29 14:24   
Repository: erp/devel/dbsm-main
Changeset: e14cb01c7638e0ea28aebeae8f34e39c50a92554
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Tue Jan 26 10:41:54 2016 +0100
URL: http://code.openbravo.com/erp/devel/dbsm-main/rev/e14cb01c7638e0ea28aebeae8f34e39c50a92554 [^]

Related with issue 31712: tests fks and constraints can be disabled and enabled

The tests check that the foreign keys and constraints can be disabled and enabled for the whole database and also for a specific table.

---
M src-test/src/org/openbravo/dbsm/test/model/ModelSuite.java
A src-test/model/constraints/TWO_TABLES_WITH_CONSTRAINTS.xml
A src-test/model/foreignKeys/TWO_TABLES_WITH_FOREIGN_KEYS.xml
A src-test/src/org/openbravo/dbsm/test/model/CheckDisableAndEnableForeignKeysAndConstraints.java
---
(0083736)
hgbot   
2016-01-29 14:32   
Repository: erp/devel/pi
Changeset: b80096ac894321c09bf620700c255fd3ef9f8890
Author: Augusto Mauch <augusto.mauch <at> openbravo.com>
Date: Fri Jan 29 14:21:19 2016 +0100
URL: http://code.openbravo.com/erp/devel/pi/rev/b80096ac894321c09bf620700c255fd3ef9f8890 [^]

Fixes issue 31712: Foreign keys and constraints can be disabled per table

Before this change the Platform class only offered methods to disable all the constraints and foreign keys of the whole database. Now it is possible to do it also on a table to table basis.

Changes done:
- Platform.java: Added public methods disableAllFkForTable, enableAllFkForTable, disableCheckConstraintsForTable, enableCheckConstraintsForTable
- PlatformImplBase.java: Provides a functional default implementation for disableCheckConstraintsForTable and enableCheckConstraintsForTable, possible because the .disableAllChecks(table) was already implemented. Also provides an implementation for disableAllFkForTable and enableAllFkForTable that just returns throw new DatabaseOperationException("Error: Operation not supported"), because it needs to be implemented in each specific platform.
- Oracle8Platform and PostgreSqlPlatform: Implementations for disableAllFkForTable and enableAllFkForTable.

Some tests have been added to check that the foreign keys and constraints can be disabled and enabled for the whole database and also for a specific table.

---
M src-db/database/lib/dbsourcemanager.jar
---
(0083950)
alostale   
2016-02-05 09:02   
code reviewed + tested
(0085091)
hudsonbot   
2016-03-17 10:55   
A changeset related to this issue has been promoted main and to the
Central Repository, after passing a series of tests.

Promotion changeset: https://code.openbravo.com/erp/devel/main/rev/b22fb0500156 [^]
Maturity status: Test