Skip to content

Commit

Permalink
fix: fix auto_increment issues for H2 (#58)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
p3t authored Sep 23, 2022
1 parent c348e4f commit ab66263
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/main/java/org/casbin/adapter/JDBCBaseAdapter.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ protected void migrate() throws SQLException {
case "PostgreSQL":
sql = renderActualSql("CREATE SEQUENCE IF NOT EXISTS CASBIN_SEQUENCE START 1;");
break;
case "H2":
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))");
break;
}

stmt.executeUpdate(sql);
Expand Down

0 comments on commit ab66263

Please sign in to comment.