Skip to content

Commit 2cee1ee

Browse files
fix: SqlLockDialectHelper for H2 (#1)
1 parent 16f9318 commit 2cee1ee

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

flamingock-sql-util/src/main/java/io/flamingock/internal/common/sql/dialectHelpers/SqlLockDialectHelper.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,14 +51,21 @@ public String getCreateTableSqlString(String tableName) {
5151
case MYSQL:
5252
case MARIADB:
5353
case SQLITE:
54-
case H2:
5554
return String.format(
5655
"CREATE TABLE IF NOT EXISTS %s (" +
5756
"`key` VARCHAR(255) PRIMARY KEY," +
5857
"status VARCHAR(32)," +
5958
"owner VARCHAR(255)," +
6059
"expires_at TIMESTAMP" +
6160
")", tableName);
61+
case H2:
62+
return String.format(
63+
"CREATE TABLE IF NOT EXISTS %s (" +
64+
"\"key\" VARCHAR(255) PRIMARY KEY," +
65+
"status VARCHAR(32)," +
66+
"owner VARCHAR(255)," +
67+
"expires_at TIMESTAMP" +
68+
")", tableName);
6269
case SQLSERVER:
6370
return String.format(
6471
"IF NOT EXISTS (SELECT * FROM sysobjects WHERE name='%s' AND xtype='U') " +
@@ -240,6 +247,7 @@ public String getDeleteLockSqlString(String tableName) {
240247
switch (sqlDialect) {
241248
case POSTGRESQL:
242249
case ORACLE:
250+
case H2:
243251
return String.format("DELETE FROM %s WHERE \"key\" = ?", tableName);
244252
case INFORMIX:
245253
case DB2:
@@ -248,7 +256,7 @@ public String getDeleteLockSqlString(String tableName) {
248256
return String.format("DELETE FROM %s WHERE lock_key = ?", tableName);
249257
case SQLSERVER:
250258
return String.format("DELETE FROM %s WHERE [key] = ?", tableName);
251-
default: // MYSQL, MARIADB, SQLITE, H2
259+
default: // MYSQL, MARIADB, SQLITE
252260
return String.format("DELETE FROM %s WHERE `key` = ?", tableName);
253261
}
254262
}

0 commit comments

Comments
 (0)