Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add result column to migration table #6580

Merged
merged 19 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
spotless
  • Loading branch information
fil512 committed Jan 4, 2025
commit 6b48dc8bfc964190545ad59916b645b36aa165e3
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ public boolean createMigrationTableIfRequired() {
if (!columnExists("RESULT")) {
String addResultColumnStatement = myMigrationQueryBuilder.addResultColumnStatement();
ourLog.info(addResultColumnStatement);
myJdbcTemplate.execute(addResultColumnStatement); }
myJdbcTemplate.execute(addResultColumnStatement);
}
return false;
}
ourLog.info("Creating table {}", myMigrationTablename);
Expand Down Expand Up @@ -150,12 +151,9 @@ private boolean migrationTableExists() {

private boolean columnExists(String theColumnName) {
try (Connection connection = myDataSource.getConnection()) {
ResultSet columns = connection.getMetaData().getColumns(
connection.getCatalog(),
connection.getSchema(),
myMigrationTablename,
theColumnName
);
ResultSet columns = connection
.getMetaData()
.getColumns(connection.getCatalog(), connection.getSchema(), myMigrationTablename, theColumnName);

return columns.next(); // If there's a row, the column exists
} catch (SQLException e) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,6 @@ public String addResultColumnStatement() {
return new AlterTableQuery(myTable).setAddColumn(myResultCol).validate().toString();
}


public String createIndexStatement() {
return new CreateIndexQuery(myTable, myMigrationTablename.toUpperCase() + "_PK_INDEX")
.setIndexType(CreateIndexQuery.IndexType.UNIQUE)
Expand Down