Correct foreign key upgrading on PG

This commit is contained in:
James Agnew 2018-09-17 14:37:49 -04:00
parent 6cfa452d8c
commit 664fd2fede
1 changed files with 12 additions and 1 deletions

View File

@ -80,7 +80,18 @@ public class AddForeignKeyTask extends BaseTableColumnTask<AddForeignKeyTask> {
sql = "alter table " + getTableName() + " add constraint " + myConstraintName + " foreign key (" + getColumnName() + ") references " + myForeignTableName; sql = "alter table " + getTableName() + " add constraint " + myConstraintName + " foreign key (" + getColumnName() + ") references " + myForeignTableName;
break; break;
} }
executeSql(sql);
try {
executeSql(sql);
} catch (Exception e) {
if (e.toString().contains("already exists")) {
ourLog.warn("Index {} already exists", myConstraintName);
} else {
throw e;
}
}
} }
} }