Skip to content

Commit

Permalink
CLDR-15850 Add vote_type column if not present in current table (#2792)
Browse files Browse the repository at this point in the history
-Use existing method DBUtils.tableHasColumn, and new ALTER TABLE statement
  • Loading branch information
btangmu authored Mar 17, 2023
1 parent 0fcfec4 commit 8f04544
Showing 1 changed file with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,14 @@ private synchronized void setupDB() {
s = null; // don't close twice.
conn.commit();
System.err.println("Created table " + DBUtils.Table.VOTE_VALUE);
} else if (!DBUtils.tableHasColumn(conn, DBUtils.Table.VOTE_VALUE.toString(), VOTE_TYPE)) {
s = conn.createStatement();
sql = "ALTER TABLE " + DBUtils.Table.VOTE_VALUE + " ADD COLUMN " + VOTE_TYPE + " TINYINT NOT NULL";
s.execute(sql);
s.close();
s = null;
conn.commit();
System.err.println("Added column " + VOTE_TYPE + " to table " + DBUtils.Table.VOTE_VALUE);
}
if (!DBUtils.hasTable(DBUtils.Table.VOTE_VALUE_ALT.toString())) {
s = conn.createStatement();
Expand Down

0 comments on commit 8f04544

Please sign in to comment.