Skip to content

Commit

Permalink
0005976: User is incorrectly warned that table is missing primary key
Browse files Browse the repository at this point in the history
  • Loading branch information
erilong committed Sep 7, 2023
1 parent f877e2a commit 51d3a34
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Expand Up @@ -108,7 +108,7 @@ public TriggerHistory(Table table, Trigger trigger, AbstractTriggerTemplate trig
this.triggerId = trigger.getTriggerId();
this.pkColumnNames = Table.getCommaDeliminatedColumns(trigger.filterExcludedAndIncludedColumns(trigger
.getSyncKeysColumnsForTable(table)));
this.isMissingPk = !table.hasPrimaryKey() || Objects.equals(pkColumnNames, columnNames) || StringUtils.isBlank(pkColumnNames);
this.isMissingPk = !table.hasPrimaryKey() || table.isMadeAllColumnsPrimaryKey() || StringUtils.isBlank(pkColumnNames);
this.triggerRowHash = trigger.toHashedValue();
this.triggerTemplateHash = triggerTemplate.toHashedValue();
this.tableHash = table.calculateTableHashcode();
Expand Down
9 changes: 9 additions & 0 deletions symmetric-db/src/main/java/org/jumpmind/db/model/Table.java
Expand Up @@ -94,6 +94,7 @@ public class Table implements Serializable, Cloneable, Comparable<Table> {
private String tableNameLowerCase;
private ArrayList<Column> lobColumns;
private CompressionTypes compressionType = CompressionTypes.NONE;
private boolean madeAllColumnsPrimaryKey;

public Table() {
}
Expand Down Expand Up @@ -1551,6 +1552,14 @@ public void setCompressionType(CompressionTypes compressionType) {
this.compressionType = compressionType;
}

public boolean isMadeAllColumnsPrimaryKey() {
return madeAllColumnsPrimaryKey;
}

public void setMadeAllColumnsPrimaryKey(boolean madeAllColumnsPrimaryKey) {
this.madeAllColumnsPrimaryKey = madeAllColumnsPrimaryKey;
}

static class ColumnPkSequenceComparator implements Comparator<Column> {
@Override
public int compare(Column o1, Column o2) {
Expand Down
Expand Up @@ -723,6 +723,7 @@ public Table makeAllColumnsPrimaryKeys(Table table) {
column.setPrimaryKey(true);
}
}
result.setMadeAllColumnsPrimaryKey(true);
}
return result;
}
Expand Down

0 comments on commit 51d3a34

Please sign in to comment.