sql更新+dev通用容器
This commit is contained in:
@@ -2,8 +2,7 @@ CREATE TABLE IF NOT EXISTS auth.tb_auth_refresh_token (
|
||||
token_id VARCHAR(64) PRIMARY KEY,
|
||||
user_id VARCHAR(64) NOT NULL,
|
||||
username VARCHAR(64) NOT NULL,
|
||||
province_code VARCHAR(12),
|
||||
area_code VARCHAR(12),
|
||||
adcode VARCHAR(12),
|
||||
tenant_id VARCHAR(64),
|
||||
tenant_path VARCHAR(255),
|
||||
dept_id VARCHAR(64),
|
||||
@@ -13,13 +12,25 @@ CREATE TABLE IF NOT EXISTS auth.tb_auth_refresh_token (
|
||||
revoked BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
COMMENT ON TABLE auth.tb_auth_refresh_token IS '认证刷新令牌表';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.token_id IS '令牌ID';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.username IS '用户名';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.adcode IS '行政区划编码';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.tenant_path IS '租户路径';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.dept_path IS '部门路径';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.refresh_token IS '刷新令牌';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.expire_at IS '过期时间';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.revoked IS '是否撤销';
|
||||
COMMENT ON COLUMN auth.tb_auth_refresh_token.created_at IS '创建时间';
|
||||
|
||||
CREATE TABLE IF NOT EXISTS auth.tb_auth_login_audit (
|
||||
audit_id VARCHAR(64) PRIMARY KEY,
|
||||
user_id VARCHAR(64),
|
||||
username VARCHAR(64) NOT NULL,
|
||||
province_code VARCHAR(12),
|
||||
area_code VARCHAR(12),
|
||||
adcode VARCHAR(12),
|
||||
tenant_id VARCHAR(64),
|
||||
tenant_path VARCHAR(255),
|
||||
dept_id VARCHAR(64),
|
||||
@@ -28,6 +39,18 @@ CREATE TABLE IF NOT EXISTS auth.tb_auth_login_audit (
|
||||
login_status VARCHAR(32) NOT NULL,
|
||||
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||
);
|
||||
COMMENT ON TABLE auth.tb_auth_login_audit IS '登录审计日志表';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.audit_id IS '审计ID';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.username IS '用户名';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.adcode IS '行政区划编码';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.tenant_id IS '租户ID';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.tenant_path IS '租户路径';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.dept_id IS '部门ID';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.dept_path IS '部门路径';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.login_ip IS '登录IP';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.login_status IS '登录状态';
|
||||
COMMENT ON COLUMN auth.tb_auth_login_audit.created_at IS '创建时间';
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_auth_refresh_token_user ON auth.tb_auth_refresh_token(user_id);
|
||||
CREATE INDEX IF NOT EXISTS idx_auth_login_audit_tenant ON auth.tb_auth_login_audit(tenant_id, created_at DESC);
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
INSERT INTO auth.tb_auth_login_audit (
|
||||
audit_id, user_id, username, province_code, area_code, tenant_id, tenant_path, dept_id, dept_path, login_ip, login_status
|
||||
audit_id, user_id, username, adcode, tenant_id, tenant_path, dept_id, dept_path, login_ip, login_status
|
||||
) VALUES (
|
||||
'audit-bootstrap-001', 'U10001', 'admin', '330000', '330100', 'SCH-HQ', '/SCH-HQ/', 'DEPT-HQ-ADMIN', '/DEPT-HQ/DEPT-HQ-ADMIN/', '127.0.0.1', 'BOOTSTRAP'
|
||||
'audit-bootstrap-001', 'U10001', 'admin', '330100', 'SCH-HQ', '/SCH-HQ/', 'DEPT-HQ-ADMIN', '/DEPT-HQ/DEPT-HQ-ADMIN/', '127.0.0.1', 'BOOTSTRAP'
|
||||
)
|
||||
ON CONFLICT (audit_id) DO NOTHING;
|
||||
|
||||
Reference in New Issue
Block a user