Commits

tbrugz committed 541919e

sqldiff: test if DBIdentifiable is dumpable

  • Participants
  • Parent commits 2b26205

Comments (0)

Files changed (2)

src_diff/tbrugz/sqldiff/model/SchemaDiff.java

 		return null;
 	}
 
+	//XXX rename to getDumpeableByXXX?
 	@SuppressWarnings("unchecked")
 	public static <T extends DBIdentifiable> T getDBIdentifiableByTypeSchemaAndName(Collection<? extends DBIdentifiable> dbids, DBObjectType type, String schemaName, String name) {
 		for(DBIdentifiable d: dbids) {
 			if(type.equals(DBIdentifiable.getType4Diff(d)) 
 					&& (d.getSchemaName()!=null?d.getSchemaName().equalsIgnoreCase(schemaName):true) 
-					&& d.getName().equalsIgnoreCase(name)) return (T) d;
+					&& d.getName().equalsIgnoreCase(name)
+					&& d.isDumpable())
+				return (T) d;
 		}
 		return null;
 	}

src_diff/tbrugz/sqldiff/model/TableDiff.java

 			if(cNew!=null) {
 				newDBObjectsThatExistsInOrigModel.add(cNew);
 				if(!cOrig.equals(cNew)) {
+					if(!cOrig.isDumpable()) {
+						log.debug("original/new object not dumpeable: "+cOrig);
+						continue;
+					}
 					log.debug("drop/add "+objType+": orig: "+cOrig+" new: "+cNew);
 					diffs.add(new DBIdentifiableDiff(ChangeType.DROP, cOrig, cNew, origOwnerTableName));
 					diffs.add(new DBIdentifiableDiff(ChangeType.ADD, cOrig, cNew, newOwnerTableName));
 				}
 			}
 			else {
+				if(!cOrig.isDumpable()) {
+					log.debug("original object not dumpeable: "+cOrig);
+					continue;
+				}
 				log.debug("drop "+objType+": orig: "+cOrig);
 				diffs.add(new DBIdentifiableDiff(ChangeType.DROP, cOrig, null, origOwnerTableName));
 			}
 		}
 		for(DBIdentifiable cNew: listNew) {
 			if(newDBObjectsThatExistsInOrigModel.contains(cNew)) { continue; }
+			if(!cNew.isDumpable()) {
+				log.debug("new object not dumpeable: "+cNew);
+				continue;
+			}
 			log.debug("add "+objType+": new: "+cNew);
 			diffs.add(new DBIdentifiableDiff(ChangeType.ADD, null, cNew, newOwnerTableName));
 		}