Skip to content

Commit

Permalink
Sort by foreign keys will also build potential channel mappings and
Browse files Browse the repository at this point in the history
missed dependencies.
  • Loading branch information
jumpmind-josh committed Dec 12, 2017
1 parent 527db90 commit d621477
Showing 1 changed file with 3 additions and 2 deletions.
Expand Up @@ -117,9 +117,10 @@ public static List<Table> sortByForeignKeys(List<Table> tables, Map<String, Tabl
Map<Table, Integer> resolvedPosition = new HashMap<Table, Integer>();

if (tablePrefix == null) { tablePrefix = "sym"; }
tablePrefix = tablePrefix.toLowerCase();

for(Table t : tables) {
if (t != null && !t.getName().toUpperCase().startsWith("SYM")) {
if (t != null && !t.getNameLowerCase().startsWith(tablePrefix)) {
depth.setValue(1);
parentPosition.setValue(-1);
resolveForeginKeyOrder(t, allTables, resolved, temporary, finalList, null, missingDependencyMap,
Expand Down Expand Up @@ -166,7 +167,7 @@ public static void resolveForeginKeyOrder(Table t, Map<String, Table> allTables,

for (ForeignKey fk : t.getForeignKeys()) {
Table fkTable = allTables.get(fk.getForeignTableName());
if (fkTable != null) {
if (fkTable != t) {
depth.increment();
resolveForeginKeyOrder(fkTable, allTables, resolved, temporary, finalList, t, missingDependencyMap,
dependencyMap, depth, position, tablePrefix, resolvedPosition, parentPosition);
Expand Down

0 comments on commit d621477

Please sign in to comment.