-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76b2bed
commit 3e9f859
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package org.casbin.adapter; | ||
|
||
import org.casbin.spring.boot.autoconfigure.properties.CasbinExceptionProperties; | ||
import org.springframework.jdbc.core.JdbcTemplate; | ||
|
||
/** | ||
* @author fangzhengjin | ||
* @version V1.0 | ||
* @title: PostgreSQLAdapter | ||
* @package org.casbin.adapter | ||
* @description: | ||
* @date 2021/05/28 09:30 | ||
*/ | ||
public class PostgreSQLAdapter extends JdbcAdapter { | ||
|
||
private final static String INIT_TABLE_SQL = "CREATE TABLE IF NOT EXISTS CASBIN_RULE (" + | ||
" id SERIAL PRIMARY KEY, "+ | ||
" ptype varchar(255) NOT NULL," + | ||
" v0 varchar(255) DEFAULT NULL," + | ||
" v1 varchar(255) DEFAULT NULL," + | ||
" v2 varchar(255) DEFAULT NULL," + | ||
" v3 varchar(255) DEFAULT NULL," + | ||
" v4 varchar(255) DEFAULT NULL," + | ||
" v5 varchar(255) DEFAULT NULL" + | ||
")"; | ||
|
||
public PostgreSQLAdapter(JdbcTemplate jdbcTemplate, CasbinExceptionProperties casbinExceptionProperties, boolean autoCreateTable) { | ||
super(jdbcTemplate, casbinExceptionProperties, autoCreateTable); | ||
} | ||
|
||
@Override | ||
protected String getInitTableSql() { | ||
return INIT_TABLE_SQL; | ||
} | ||
} |