Skip to content

Commit

Permalink
fix: Postgres schema upgrade using wrong syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Nov 5, 2024
1 parent 4988777 commit bece27a
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public boolean isCreated() {
public int getSchemaVersion() {
try (Connection connection = getConnection()) {
try (PreparedStatement statement = connection.prepareStatement(format("""
SELECT schema_version
SELECT "schema_version"
FROM "%meta_data%"
LIMIT 1;"""))) {
final ResultSet resultSet = statement.executeQuery();
Expand All @@ -183,7 +183,7 @@ public void setSchemaVersion(int version) {
if (getSchemaVersion() == -1) {
try (Connection connection = getConnection()) {
try (PreparedStatement insertStatement = connection.prepareStatement(format("""
INSERT INTO "%meta_data%" (`schema_version`)
INSERT INTO "%meta_data%" ("schema_version")
VALUES (?)"""))) {
insertStatement.setInt(1, version);
insertStatement.executeUpdate();
Expand All @@ -197,7 +197,7 @@ public void setSchemaVersion(int version) {
try (Connection connection = getConnection()) {
try (PreparedStatement statement = connection.prepareStatement(format("""
UPDATE "%meta_data%"
SET `schema_version` = ?;"""))) {
SET "schema_version" = ?;"""))) {
statement.setInt(1, version);
statement.executeUpdate();
}
Expand Down

0 comments on commit bece27a

Please sign in to comment.