Skip to content

Commit ab66263

Browse files
authored
fix: fix auto_increment issues for H2 (#58)
I wouldn't say this is an fully tested H2 support, but it allows an application to start-up using H2 without an SQL exception.
1 parent c348e4f commit ab66263

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/main/java/org/casbin/adapter/JDBCBaseAdapter.java

+3
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,9 @@ protected void migrate() throws SQLException {
129129
case "PostgreSQL":
130130
sql = renderActualSql("CREATE SEQUENCE IF NOT EXISTS CASBIN_SEQUENCE START 1;");
131131
break;
132+
case "H2":
133+
sql = renderActualSql("CREATE TABLE IF NOT EXISTS casbin_rule(id int GENERATED ALWAYS AS IDENTITY PRIMARY KEY, ptype VARCHAR(100) NOT NULL, v0 VARCHAR(100), v1 VARCHAR(100), v2 VARCHAR(100), v3 VARCHAR(100), v4 VARCHAR(100), v5 VARCHAR(100))");
134+
break;
132135
}
133136

134137
stmt.executeUpdate(sql);

0 commit comments

Comments
 (0)