Correct foreign key upgrading on PG
This commit is contained in:
parent
6cfa452d8c
commit
664fd2fede
|
@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue