Skip to content

Commit

Permalink
Fixed primary key for island upgrades table not being removed correct…
Browse files Browse the repository at this point in the history
…ly (#914)
  • Loading branch information
OmerBenGera committed Feb 10, 2022
1 parent 49e15a3 commit cb5b2b7
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -147,6 +147,8 @@ public void removePrimaryKey(String tableName, String columnName, QueryResult<Vo
executeQuery(String.format("PRAGMA table_info('%s')", tableName), new QueryResult<ResultSet>()
.onSuccess(resultSet -> {
if (resultSet.next() && resultSet.getInt("pk") == 1) {
resultSet.close();
executeUpdate(String.format("DROP TABLE %s_copy;", tableName), QueryResult.EMPTY_VOID_QUERY_RESULT);
executeUpdate(String.format("CREATE TABLE %s_copy AS SELECT * FROM %s;", tableName, tableName), queryResult);
executeUpdate(String.format("DROP TABLE %s;", tableName), queryResult);
renameTable(tableName + "_copy", tableName, queryResult);
Expand Down

0 comments on commit cb5b2b7

Please sign in to comment.