Skip to content

Commit

Permalink
Merge pull request #3040 from SCADA-LTS/fix/#2755_Signaling_the_Data_…
Browse files Browse the repository at this point in the history
…Source_that_has_a_problem

#2755 Signaling the data source that has a problem:
  • Loading branch information
Limraj authored Nov 6, 2024
2 parents b5b6abb + 2b7e61c commit efb2377
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,11 @@ public void migrate(Context context) throws Exception {
}

private void migrate(JdbcTemplate jdbcTmp) {
String sql = "ALTER TABLE events ADD COLUMN typeRef3 int not null";
try {
jdbcTmp.update(sql);
} catch (Exception ex) {
if(ex.getMessage() != null && !ex.getMessage().contains("Duplicate"))
throw ex;
LOG.warn(ex.getMessage(), ex);
}

boolean existsTypeRef3Column = jdbcTmp.queryForObject("SELECT (SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE `TABLE_SCHEMA`= DATABASE() AND `TABLE_NAME`='events' AND `COLUMN_NAME`='typeRef3') IS NOT NULL;", boolean.class);

if(!existsTypeRef3Column)
jdbcTmp.update( "ALTER TABLE events ADD COLUMN typeRef3 int not null");
}
}

0 comments on commit efb2377

Please sign in to comment.