Author: tolusha
Date: 2011-11-17 10:38:50 -0500 (Thu, 17 Nov 2011)
New Revision: 5200
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
Log:
EXOJCR-1644: Wrong rollback scripts of the DBCleaner for some DBs: PostgreSQL on
connection.rollback() restores all removed constrains
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java
===================================================================
---
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-11-17
14:13:11 UTC (rev 5199)
+++
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/clean/rdbms/DBCleanService.java 2011-11-17
15:38:50 UTC (rev 5200)
@@ -896,8 +896,13 @@
String constraint =
"CONSTRAINT " + constraintName + " FOREIGN KEY(PARENT_ID)
REFERENCES JCR_" + multiDb + "ITEM(ID)";
commitScripts.add("ALTER TABLE JCR_" + multiDb + "ITEM ADD "
+ constraint);
- rollbackScripts.add("ALTER TABLE JCR_" + multiDb + "ITEM ADD
" + constraint);
+ // PostgreSQL on connection.rollback() restores all removed constrains
+ if (!dialect.equalsIgnoreCase(DBConstants.DB_DIALECT_PGSQL))
+ {
+ rollbackScripts.add("ALTER TABLE JCR_" + multiDb + "ITEM ADD
" + constraint);
+ }
+
cleanScripts
.add("delete from JCR_SVALUE where PROPERTY_ID IN (select ID from
JCR_SITEM where CONTAINER_NAME='"
+ containerName + "')");