zyjblogs-parent/config/db/postgres/zyjblogs_rbac.sql
2023-04-07 14:41:50 +08:00

66 lines
4.2 KiB
SQL

CREATE TABLE oauth_client_details (
client_id varchar(255) NOT NULL,
resource_ids varchar(255) DEFAULT NULL,
client_secret varchar(255) DEFAULT NULL,
scope varchar(255) DEFAULT NULL,
authorized_grant_types varchar(255) DEFAULT NULL,
web_server_redirect_uri varchar(255) DEFAULT NULL,
authorities varchar(255) DEFAULT NULL,
access_token_validity int DEFAULT NULL,
refresh_token_validity int DEFAULT NULL,
additional_information text ,
create_time timestamp NOT NULL DEFAULT NOW(),
archived smallint DEFAULT 0,
trusted smallint DEFAULT 0,
autoapprove varchar(255) DEFAULT 'false',
PRIMARY KEY (client_id)
);
INSERT INTO oauth_client_details (client_id, resource_ids, client_secret, scope, authorized_grant_types, web_server_redirect_uri, authorities, access_token_validity, refresh_token_validity, additional_information, create_time, archived, trusted, autoapprove) VALUES ('zyjblogs-oauth','zyjblogs-oauth,zyjblogs-rbac','$2a$10$Wk2w4OX5DpFgG3rBuhPnnulCSOIuU3TZhpWjaOq39LZnL.p0LJila','all','authorization_code,password,client_credentials,implicit,refresh_token','http://localhost:9019/',NULL,NULL,NULL,NULL,'2022-08-18 06:14:32',0,0,'false'),('zyjblogs-rbac','zyjblogs-rbac,zyjblogs-oauth','$2a$10$Wk2w4OX5DpFgG3rBuhPnnulCSOIuU3TZhpWjaOq39LZnL.p0LJila','all','authorization_code,password,client_credentials,implicit,refresh_token','http://localhost:9029/',NULL,NULL,NULL,NULL,'2022-08-18 00:34:24',0,0,'false');
CREATE TABLE oauth_code (
create_time timestamp WITH TIME ZONE NOT NULL DEFAULT NOW(),
code varchar(255) DEFAULT NULL,
authentication bytea
) ;
create index code_index on oauth_code(code);
CREATE TABLE role (
id varchar(64) NOT NULL,
name varchar(64) DEFAULT NULL ,
status int DEFAULT NULL ,
deleted smallint DEFAULT 0,
description varchar(600) ,
create_user_id varchar(64) ,
create_time timestamp NOT NULL DEFAULT NOW(),
edit_user_id varchar(64) ,
edit_time timestamp NOT NULL DEFAULT NOW(),
tenant_id varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY (id)
);
CREATE TABLE users (
id varchar(64) NOT NULL ,
username varchar(64) NOT NULL ,
name varchar(64) DEFAULT NULL ,
age int DEFAULT NULL ,
avatar varchar(255) DEFAULT NULL ,
password varchar(255) DEFAULT NULL,
phone char(11) DEFAULT NULL ,
email varchar(64) DEFAULT NULL ,
invite_user_id varchar(64) DEFAULT NULL ,
status int DEFAULT NULL ,
follow_num int DEFAULT NULL ,
fans_num int DEFAULT NULL ,
deleted smallint DEFAULT 0,
description varchar(600) DEFAULT NULL,
create_user_id varchar(64) ,
create_time timestamp NOT NULL DEFAULT NOW(),
edit_user_id varchar(64) ,
edit_time timestamp NOT NULL DEFAULT NOW(),
tenant_id varchar(100) NOT NULL DEFAULT '',
PRIMARY KEY (id)
);
create index username_index on users(username);
INSERT INTO users (id, username, name, age, avatar, password, phone, email, invite_user_id, status, follow_num, fans_num, deleted, description, create_user_id, create_time, edit_user_id, edit_time, tenant_id) VALUES ('1','admin','admin',1,NULL,'$2a$10$4DlfvZrq7zgKzkbKyg.GHO6yHdGnozcaf3B5JSAC0fNB4k1GhMk6y',NULL,NULL,NULL,0,NULL,NULL,0,NULL,NULL,now(),NULL,now(),'');