-- ----------------------------
-- Sequence structure for system_user_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "system_user_seq";
CREATE SEQUENCE "system_user_seq"
    INCREMENT 1
MAXVALUE 9223372036854775807
CACHE 1;

-- ----------------------------
-- Table structure for system_users
-- ----------------------------
DROP TABLE IF EXISTS "system_users";
CREATE TABLE "system_users"
(
    "id"          int8                                        NOT NULL,
    "username"    varchar(30) COLLATE "pg_catalog"."default"  NOT NULL,
    "password"    varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
    "nickname"    varchar(30) COLLATE "pg_catalog"."default"  NOT NULL,
    "remark"      varchar(500) COLLATE "pg_catalog"."default",
    "dept_id"     int8,
    "post_ids"    varchar(255) COLLATE "pg_catalog"."default",
    "email"       varchar(50) COLLATE "pg_catalog"."default",
    "mobile"      varchar(11) COLLATE "pg_catalog"."default",
    "sex"         int2,
    "avatar"      varchar(100) COLLATE "pg_catalog"."default",
    "status"      int2                                        NOT NULL,
    "login_ip"    varchar(50) COLLATE "pg_catalog"."default",
    "login_date"  timestamp(6),
    "creator"     varchar(64) COLLATE "pg_catalog"."default",
    "create_time" timestamp(6)                                NOT NULL,
    "updater"     varchar(64) COLLATE "pg_catalog"."default",
    "update_time" timestamp(6)                                NOT NULL,
    "deleted"     int2                                        NOT NULL DEFAULT 0,
    "tenant_id"   int8                                        NOT NULL DEFAULT 0
)
;
COMMENT
ON COLUMN "system_users"."id" IS '用户ID';
COMMENT
ON COLUMN "system_users"."username" IS '用户账号';
COMMENT
ON COLUMN "system_users"."password" IS '密码';
COMMENT
ON COLUMN "system_users"."nickname" IS '用户昵称';
COMMENT
ON COLUMN "system_users"."remark" IS '备注';
COMMENT
ON COLUMN "system_users"."dept_id" IS '部门ID';
COMMENT
ON COLUMN "system_users"."post_ids" IS '岗位编号数组';
COMMENT
ON COLUMN "system_users"."email" IS '用户邮箱';
COMMENT
ON COLUMN "system_users"."mobile" IS '手机号码';
COMMENT
ON COLUMN "system_users"."sex" IS '用户性别';
COMMENT
ON COLUMN "system_users"."avatar" IS '头像地址';
COMMENT
ON COLUMN "system_users"."status" IS '帐号状态（0正常 1停用）';
COMMENT
ON COLUMN "system_users"."login_ip" IS '最后登录IP';
COMMENT
ON COLUMN "system_users"."login_date" IS '最后登录时间';
COMMENT
ON COLUMN "system_users"."creator" IS '创建者';
COMMENT
ON COLUMN "system_users"."create_time" IS '创建时间';
COMMENT
ON COLUMN "system_users"."updater" IS '更新者';
COMMENT
ON COLUMN "system_users"."update_time" IS '更新时间';
COMMENT
ON COLUMN "system_users"."deleted" IS '是否删除';
COMMENT
ON COLUMN "system_users"."tenant_id" IS '租户编号';
COMMENT
ON TABLE "system_users" IS '用户信息表';

-- ----------------------------
-- Records of system_users
-- ----------------------------
BEGIN;
INSERT INTO "system_users" ("id", "username", "password", "nickname", "remark", "dept_id", "post_ids", "email",
                            "mobile", "sex", "avatar", "status", "login_ip", "login_date", "creator", "create_time",
                            "updater", "update_time", "deleted", "tenant_id")
VALUES (1, 'admin', '$2a$10$0acJOIk2D25/oC87nyclE..0lzeu9DtQ/n3geP4fkun/zIVRhHJIO', '管理员', '管理员', 103, '[1]',
        '', '', 1, '', 0,
        '127.0.0.1', '2022-05-25 23:44:33.003', 'admin', '2021-01-05 17:03:47', NULL, '2022-05-25 23:44:33.003', 0, 1);
COMMIT;

-- ----------------------------
-- Sequence structure for system_login_log_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "system_login_log_seq";
CREATE SEQUENCE "system_login_log_seq"
    INCREMENT 1
MAXVALUE 9223372036854775807
CACHE 1;

-- ----------------------------
-- Table structure for system_login_log
-- ----------------------------
DROP TABLE IF EXISTS "system_login_log";
CREATE TABLE "system_login_log"
(
    "id"          int8                                        NOT NULL,
    "log_type"    int8                                        NOT NULL,
    "trace_id"    varchar(64) COLLATE "pg_catalog"."default"  NOT NULL,
    "user_id"     varchar(64) COLLATE "pg_catalog"."default"  NOT NULL,
    "user_type"   int2                                        ,
    "username"    varchar(50) COLLATE "pg_catalog"."default"  NOT NULL,
    "result"      int2                                        NOT NULL,
    "user_ip"     varchar(50) COLLATE "pg_catalog"."default"  NOT NULL,
    "user_agent"  varchar(512) COLLATE "pg_catalog"."default" NOT NULL,
    "creator"     varchar(64) COLLATE "pg_catalog"."default",
    "create_time" timestamp(6)                                NOT NULL,
    "updater"     varchar(64) COLLATE "pg_catalog"."default",
    "update_time" timestamp(6)                                NOT NULL,
    "deleted"     int2                                        NOT NULL DEFAULT 0,
    "tenant_id"   int8                                        NOT NULL DEFAULT 0
)
;
COMMENT
ON COLUMN "system_login_log"."id" IS '访问ID';
COMMENT
ON COLUMN "system_login_log"."log_type" IS '日志类型';
COMMENT
ON COLUMN "system_login_log"."trace_id" IS '链路追踪编号';
COMMENT
ON COLUMN "system_login_log"."user_id" IS '用户编号';
COMMENT
ON COLUMN "system_login_log"."user_type" IS '用户类型';
COMMENT
ON COLUMN "system_login_log"."username" IS '用户账号';
COMMENT
ON COLUMN "system_login_log"."result" IS '登陆结果';
COMMENT
ON COLUMN "system_login_log"."user_ip" IS '用户 IP';
COMMENT
ON COLUMN "system_login_log"."user_agent" IS '浏览器 UA';
COMMENT
ON COLUMN "system_login_log"."creator" IS '创建者';
COMMENT
ON COLUMN "system_login_log"."create_time" IS '创建时间';
COMMENT
ON COLUMN "system_login_log"."updater" IS '更新者';
COMMENT
ON COLUMN "system_login_log"."update_time" IS '更新时间';
COMMENT
ON COLUMN "system_login_log"."deleted" IS '是否删除';
COMMENT
ON COLUMN "system_login_log"."tenant_id" IS '租户编号';
COMMENT
ON TABLE "system_login_log" IS '系统访问记录';

-- ----------------------------
-- Sequence structure for system_operate_log_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "system_operate_log_seq";
CREATE SEQUENCE "system_operate_log_seq"
    INCREMENT 1
MAXVALUE 9223372036854775807
CACHE 1;

-- ----------------------------
-- Table structure for system_operate_log
-- ----------------------------
DROP TABLE IF EXISTS "system_operate_log";
CREATE TABLE "system_operate_log"
(
    "id"               int8                                         NOT NULL,
    "trace_id"         varchar(64) COLLATE "pg_catalog"."default"   NOT NULL,
    "user_id"          varchar(64) COLLATE "pg_catalog"."default"   NOT NULL,
    "user_type"        int2                                         NOT NULL,
    "module"           varchar(50) COLLATE "pg_catalog"."default"   NOT NULL,
    "name"             varchar(50) COLLATE "pg_catalog"."default"   NOT NULL,
    "type"             int8                                         NOT NULL,
    "content"          varchar(2000) COLLATE "pg_catalog"."default" NOT NULL DEFAULT '':: character varying,
    "exts"             varchar(512) COLLATE "pg_catalog"."default"  NOT NULL DEFAULT '':: character varying,
    "request_method"   varchar(16) COLLATE "pg_catalog"."default",
    "request_url"      varchar(255) COLLATE "pg_catalog"."default",
    "user_ip"          varchar(50) COLLATE "pg_catalog"."default",
    "user_agent"       varchar(200) COLLATE "pg_catalog"."default",
    "java_method"      varchar(512) COLLATE "pg_catalog"."default"  NOT NULL,
    "java_method_args" varchar(8000) COLLATE "pg_catalog"."default",
    "start_time"       timestamp(6)                                 NOT NULL,
    "duration"         int4                                         NOT NULL,
    "result_code"      int4                                         NOT NULL,
    "result_msg"       varchar(512) COLLATE "pg_catalog"."default",
    "result_data"      varchar(4000) COLLATE "pg_catalog"."default",
    "creator"          varchar(64) COLLATE "pg_catalog"."default",
    "create_time"      timestamp(6)                                 NOT NULL,
    "updater"          varchar(64) COLLATE "pg_catalog"."default",
    "update_time"      timestamp(6)                                 NOT NULL,
    "deleted"          int2                                         NOT NULL DEFAULT 0,
    "tenant_id"        int8                                         NOT NULL DEFAULT 0
)
;
COMMENT
ON COLUMN "system_operate_log"."id" IS '日志主键';
COMMENT
ON COLUMN "system_operate_log"."trace_id" IS '链路追踪编号';
COMMENT
ON COLUMN "system_operate_log"."user_id" IS '用户编号';
COMMENT
ON COLUMN "system_operate_log"."user_type" IS '用户类型';
COMMENT
ON COLUMN "system_operate_log"."module" IS '模块标题';
COMMENT
ON COLUMN "system_operate_log"."name" IS '操作名';
COMMENT
ON COLUMN "system_operate_log"."type" IS '操作分类';
COMMENT
ON COLUMN "system_operate_log"."content" IS '操作内容';
COMMENT
ON COLUMN "system_operate_log"."exts" IS '拓展字段';
COMMENT
ON COLUMN "system_operate_log"."request_method" IS '请求方法名';
COMMENT
ON COLUMN "system_operate_log"."request_url" IS '请求地址';
COMMENT
ON COLUMN "system_operate_log"."user_ip" IS '用户 IP';
COMMENT
ON COLUMN "system_operate_log"."user_agent" IS '浏览器 UA';
COMMENT
ON COLUMN "system_operate_log"."java_method" IS 'Java 方法名';
COMMENT
ON COLUMN "system_operate_log"."java_method_args" IS 'Java 方法的参数';
COMMENT
ON COLUMN "system_operate_log"."start_time" IS '操作时间';
COMMENT
ON COLUMN "system_operate_log"."duration" IS '执行时长';
COMMENT
ON COLUMN "system_operate_log"."result_code" IS '结果码';
COMMENT
ON COLUMN "system_operate_log"."result_msg" IS '结果提示';
COMMENT
ON COLUMN "system_operate_log"."result_data" IS '结果数据';
COMMENT
ON COLUMN "system_operate_log"."creator" IS '创建者';
COMMENT
ON COLUMN "system_operate_log"."create_time" IS '创建时间';
COMMENT
ON COLUMN "system_operate_log"."updater" IS '更新者';
COMMENT
ON COLUMN "system_operate_log"."update_time" IS '更新时间';
COMMENT
ON COLUMN "system_operate_log"."deleted" IS '是否删除';
COMMENT
ON COLUMN "system_operate_log"."tenant_id" IS '租户编号';
COMMENT
ON TABLE "system_operate_log" IS '操作日志记录';

-- ----------------------------
-- Sequence structure for system_oauth2_access_token_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "system_oauth2_access_token_seq";
CREATE SEQUENCE "system_oauth2_access_token_seq"
    INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for system_oauth2_approve_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "system_oauth2_approve_seq";
CREATE SEQUENCE "system_oauth2_approve_seq"
    INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for system_oauth2_client_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "system_oauth2_client_seq";
CREATE SEQUENCE "system_oauth2_client_seq"
    INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for system_oauth2_code_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "system_oauth2_code_seq";
CREATE SEQUENCE "system_oauth2_code_seq"
    INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;

-- ----------------------------
-- Sequence structure for system_oauth2_refresh_token_seq
-- ----------------------------
DROP SEQUENCE IF EXISTS "system_oauth2_refresh_token_seq";
CREATE SEQUENCE "system_oauth2_refresh_token_seq"
    INCREMENT 1
MINVALUE  1
MAXVALUE 9223372036854775807
START 1
CACHE 1;
-- ----------------------------
-- Table structure for system_oauth2_access_token
-- ----------------------------
DROP TABLE IF EXISTS "system_oauth2_access_token";
CREATE TABLE "system_oauth2_access_token"
(
    "id"            int8                                        NOT NULL,
    "user_id"       int8                                        NOT NULL,
    "access_token"  varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "refresh_token" varchar(32) COLLATE "pg_catalog"."default"  NOT NULL,
    "user_type"     int2                                        NOT NULL,
    "client_id"     varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "expires_time"  timestamp(6)                                NOT NULL,
    "creator"       varchar(64) COLLATE "pg_catalog"."default",
    "create_time"   timestamp(6)                                NOT NULL,
    "updater"       varchar(64) COLLATE "pg_catalog"."default",
    "update_time"   timestamp(6)                                NOT NULL,
    "deleted"       int2                                        NOT NULL DEFAULT 0,
    "tenant_id"     int8                                        NOT NULL DEFAULT 0,
    "scopes"        varchar(255) COLLATE "pg_catalog"."default"          DEFAULT '':: character varying
)
;
COMMENT
ON COLUMN "system_oauth2_access_token"."id" IS '编号';
COMMENT
ON COLUMN "system_oauth2_access_token"."user_id" IS '用户编号';
COMMENT
ON COLUMN "system_oauth2_access_token"."access_token" IS '访问令牌';
COMMENT
ON COLUMN "system_oauth2_access_token"."refresh_token" IS '刷新令牌';
COMMENT
ON COLUMN "system_oauth2_access_token"."user_type" IS '用户类型';
COMMENT
ON COLUMN "system_oauth2_access_token"."client_id" IS '客户端编号';
COMMENT
ON COLUMN "system_oauth2_access_token"."expires_time" IS '过期时间';
COMMENT
ON COLUMN "system_oauth2_access_token"."creator" IS '创建者';
COMMENT
ON COLUMN "system_oauth2_access_token"."create_time" IS '创建时间';
COMMENT
ON COLUMN "system_oauth2_access_token"."updater" IS '更新者';
COMMENT
ON COLUMN "system_oauth2_access_token"."update_time" IS '更新时间';
COMMENT
ON COLUMN "system_oauth2_access_token"."deleted" IS '是否删除';
COMMENT
ON COLUMN "system_oauth2_access_token"."tenant_id" IS '租户编号';
COMMENT
ON COLUMN "system_oauth2_access_token"."scopes" IS '授权范围';
COMMENT
ON TABLE "system_oauth2_access_token" IS '刷新令牌';

-- ----------------------------
-- Records of system_oauth2_access_token
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for system_oauth2_approve
-- ----------------------------
DROP TABLE IF EXISTS "system_oauth2_approve";
CREATE TABLE "system_oauth2_approve"
(
    "id"           int8                                        NOT NULL,
    "user_id"      int8                                        NOT NULL,
    "user_type"    int2                                        NOT NULL,
    "client_id"    varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "scope"        varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "approved"     bool                                        NOT NULL,
    "expires_time" timestamp(6)                                NOT NULL,
    "creator"      varchar(64) COLLATE "pg_catalog"."default",
    "create_time"  timestamp(6)                                NOT NULL,
    "updater"      varchar(64) COLLATE "pg_catalog"."default",
    "update_time"  timestamp(6)                                NOT NULL,
    "deleted"      int2                                        NOT NULL DEFAULT 0,
    "tenant_id"    int8                                        NOT NULL DEFAULT 0
)
;
COMMENT
ON COLUMN "system_oauth2_approve"."id" IS '编号';
COMMENT
ON COLUMN "system_oauth2_approve"."user_id" IS '用户编号';
COMMENT
ON COLUMN "system_oauth2_approve"."user_type" IS '用户类型';
COMMENT
ON COLUMN "system_oauth2_approve"."client_id" IS '客户端编号';
COMMENT
ON COLUMN "system_oauth2_approve"."scope" IS '授权范围';
COMMENT
ON COLUMN "system_oauth2_approve"."approved" IS '是否接受';
COMMENT
ON COLUMN "system_oauth2_approve"."expires_time" IS '过期时间';
COMMENT
ON COLUMN "system_oauth2_approve"."creator" IS '创建者';
COMMENT
ON COLUMN "system_oauth2_approve"."create_time" IS '创建时间';
COMMENT
ON COLUMN "system_oauth2_approve"."updater" IS '更新者';
COMMENT
ON COLUMN "system_oauth2_approve"."update_time" IS '更新时间';
COMMENT
ON COLUMN "system_oauth2_approve"."deleted" IS '是否删除';
COMMENT
ON COLUMN "system_oauth2_approve"."tenant_id" IS '租户编号';
COMMENT
ON TABLE "system_oauth2_approve" IS 'OAuth2 批准表';

-- ----------------------------
-- Records of system_oauth2_approve
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for system_oauth2_client
-- ----------------------------
DROP TABLE IF EXISTS "system_oauth2_client";
CREATE TABLE "system_oauth2_client"
(
    "id"                             int8                                        NOT NULL,
    "client_id"                      varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "secret"                         varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "name"                           varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "logo"                           varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "description"                    varchar(255) COLLATE "pg_catalog"."default",
    "status"                         int2                                        NOT NULL,
    "access_token_validity_seconds"  int4                                        NOT NULL,
    "refresh_token_validity_seconds" int4                                        NOT NULL,
    "redirect_uris"                  varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "authorized_grant_types"         varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "scopes"                         varchar(255) COLLATE "pg_catalog"."default",
    "authorities"                    varchar(255) COLLATE "pg_catalog"."default",
    "resource_ids"                   varchar(255) COLLATE "pg_catalog"."default",
    "additional_information"         varchar(4096) COLLATE "pg_catalog"."default",
    "creator"                        varchar(64) COLLATE "pg_catalog"."default",
    "create_time"                    timestamp(6)                                NOT NULL,
    "updater"                        varchar(64) COLLATE "pg_catalog"."default",
    "update_time"                    timestamp(6)                                NOT NULL,
    "deleted"                        int2                                        NOT NULL DEFAULT 0,
    "auto_approve_scopes"            varchar(255) COLLATE "pg_catalog"."default"
)
;
COMMENT
ON COLUMN "system_oauth2_client"."id" IS '编号';
COMMENT
ON COLUMN "system_oauth2_client"."client_id" IS '客户端编号';
COMMENT
ON COLUMN "system_oauth2_client"."secret" IS '客户端密钥';
COMMENT
ON COLUMN "system_oauth2_client"."name" IS '应用名';
COMMENT
ON COLUMN "system_oauth2_client"."logo" IS '应用图标';
COMMENT
ON COLUMN "system_oauth2_client"."description" IS '应用描述';
COMMENT
ON COLUMN "system_oauth2_client"."status" IS '状态';
COMMENT
ON COLUMN "system_oauth2_client"."access_token_validity_seconds" IS '访问令牌的有效期';
COMMENT
ON COLUMN "system_oauth2_client"."refresh_token_validity_seconds" IS '刷新令牌的有效期';
COMMENT
ON COLUMN "system_oauth2_client"."redirect_uris" IS '可重定向的 URI 地址';
COMMENT
ON COLUMN "system_oauth2_client"."authorized_grant_types" IS '授权类型';
COMMENT
ON COLUMN "system_oauth2_client"."scopes" IS '授权范围';
COMMENT
ON COLUMN "system_oauth2_client"."authorities" IS '权限';
COMMENT
ON COLUMN "system_oauth2_client"."resource_ids" IS '资源';
COMMENT
ON COLUMN "system_oauth2_client"."additional_information" IS '附加信息';
COMMENT
ON COLUMN "system_oauth2_client"."creator" IS '创建者';
COMMENT
ON COLUMN "system_oauth2_client"."create_time" IS '创建时间';
COMMENT
ON COLUMN "system_oauth2_client"."updater" IS '更新者';
COMMENT
ON COLUMN "system_oauth2_client"."update_time" IS '更新时间';
COMMENT
ON COLUMN "system_oauth2_client"."deleted" IS '是否删除';
COMMENT
ON COLUMN "system_oauth2_client"."auto_approve_scopes" IS '自动通过的授权范围';
COMMENT
ON TABLE "system_oauth2_client" IS 'OAuth2 客户端表';

-- ----------------------------
-- Records of system_oauth2_client
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for system_oauth2_code
-- ----------------------------
DROP TABLE IF EXISTS "system_oauth2_code";
CREATE TABLE "system_oauth2_code"
(
    "id"           int8                                        NOT NULL,
    "user_id"      int8                                        NOT NULL,
    "user_type"    int2                                        NOT NULL,
    "code"         varchar(32) COLLATE "pg_catalog"."default"  NOT NULL,
    "client_id"    varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "scopes"       varchar(255) COLLATE "pg_catalog"."default",
    "expires_time" timestamp(6)                                NOT NULL,
    "redirect_uri" varchar(255) COLLATE "pg_catalog"."default",
    "state"        varchar(255) COLLATE "pg_catalog"."default",
    "creator"      varchar(64) COLLATE "pg_catalog"."default",
    "create_time"  timestamp(6)                                NOT NULL,
    "updater"      varchar(64) COLLATE "pg_catalog"."default",
    "update_time"  timestamp(6)                                NOT NULL,
    "deleted"      int2                                        NOT NULL DEFAULT 0,
    "tenant_id"    int8                                        NOT NULL DEFAULT 0
)
;
COMMENT
ON COLUMN "system_oauth2_code"."id" IS '编号';
COMMENT
ON COLUMN "system_oauth2_code"."user_id" IS '用户编号';
COMMENT
ON COLUMN "system_oauth2_code"."user_type" IS '用户类型';
COMMENT
ON COLUMN "system_oauth2_code"."code" IS '授权码';
COMMENT
ON COLUMN "system_oauth2_code"."client_id" IS '客户端编号';
COMMENT
ON COLUMN "system_oauth2_code"."scopes" IS '授权范围';
COMMENT
ON COLUMN "system_oauth2_code"."expires_time" IS '过期时间';
COMMENT
ON COLUMN "system_oauth2_code"."redirect_uri" IS '可重定向的 URI 地址';
COMMENT
ON COLUMN "system_oauth2_code"."state" IS '状态';
COMMENT
ON COLUMN "system_oauth2_code"."creator" IS '创建者';
COMMENT
ON COLUMN "system_oauth2_code"."create_time" IS '创建时间';
COMMENT
ON COLUMN "system_oauth2_code"."updater" IS '更新者';
COMMENT
ON COLUMN "system_oauth2_code"."update_time" IS '更新时间';
COMMENT
ON COLUMN "system_oauth2_code"."deleted" IS '是否删除';
COMMENT
ON COLUMN "system_oauth2_code"."tenant_id" IS '租户编号';
COMMENT
ON TABLE "system_oauth2_code" IS 'OAuth2 授权码表';

-- ----------------------------
-- Records of system_oauth2_code
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for system_oauth2_refresh_token
-- ----------------------------
DROP TABLE IF EXISTS "system_oauth2_refresh_token";
CREATE TABLE "system_oauth2_refresh_token"
(
    "id"            int8                                        NOT NULL,
    "user_id"       int8                                        NOT NULL,
    "refresh_token" varchar(32) COLLATE "pg_catalog"."default"  NOT NULL,
    "user_type"     int2                                        NOT NULL,
    "client_id"     varchar(255) COLLATE "pg_catalog"."default" NOT NULL,
    "expires_time"  timestamp(6)                                NOT NULL,
    "creator"       varchar(64) COLLATE "pg_catalog"."default",
    "create_time"   timestamp(6)                                NOT NULL,
    "updater"       varchar(64) COLLATE "pg_catalog"."default",
    "update_time"   timestamp(6)                                NOT NULL,
    "deleted"       int2                                        NOT NULL DEFAULT 0,
    "tenant_id"     int8                                        NOT NULL DEFAULT 0,
    "scopes"        varchar(255) COLLATE "pg_catalog"."default"          DEFAULT '':: character varying
)
;
COMMENT
ON COLUMN "system_oauth2_refresh_token"."id" IS '编号';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."user_id" IS '用户编号';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."refresh_token" IS '刷新令牌';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."user_type" IS '用户类型';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."client_id" IS '客户端编号';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."expires_time" IS '过期时间';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."creator" IS '创建者';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."create_time" IS '创建时间';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."updater" IS '更新者';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."update_time" IS '更新时间';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."deleted" IS '是否删除';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."tenant_id" IS '租户编号';
COMMENT
ON COLUMN "system_oauth2_refresh_token"."scopes" IS '授权范围';
COMMENT
ON TABLE "system_oauth2_refresh_token" IS '刷新令牌';

-- ----------------------------
-- Records of system_oauth2_refresh_token
-- ----------------------------
BEGIN;
COMMIT;