/*
 Navicat Premium Data Transfer

 Source Server         : 智慧法务
 Source Server Type    : PostgreSQL
 Source Server Version : 170005
 Source Host           : nas.7bm.co:54302
 Source Catalog        : docauditai
 Source Schema         : public

 Target Server Type    : PostgreSQL
 Target Server Version : 170005
 File Encoding         : 65001

 Date: 18/07/2025 15:16:47
*/


-- ----------------------------
-- Table structure for sys_routes
-- ----------------------------
DROP TABLE IF EXISTS "public"."sys_routes";
CREATE TABLE "public"."sys_routes" (
  "id" int4 NOT NULL DEFAULT nextval('sys_route_id_seq'::regclass),
  "path" varchar(100) COLLATE "pg_catalog"."default" NOT NULL,
  "name" varchar(50) COLLATE "pg_catalog"."default" NOT NULL,
  "meta" json NOT NULL,
  "parent_id" int4 DEFAULT 0,
  "is_menu" int2 DEFAULT 1,
  "create_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP,
  "update_time" timestamp(6) DEFAULT CURRENT_TIMESTAMP
)
;
COMMENT ON COLUMN "public"."sys_routes"."id" IS '路由ID';
COMMENT ON COLUMN "public"."sys_routes"."path" IS '路由路径(如：/user/list)';
COMMENT ON COLUMN "public"."sys_routes"."name" IS '路由唯一标识(前端组件名)';
COMMENT ON COLUMN "public"."sys_routes"."meta" IS '元数据(存储图标/排序/隐藏等配置)';
COMMENT ON COLUMN "public"."sys_routes"."parent_id" IS '父路由ID(0=根节点)';
COMMENT ON COLUMN "public"."sys_routes"."is_menu" IS '是否菜单项(0=接口权限, 1=菜单项)';
COMMENT ON COLUMN "public"."sys_routes"."create_time" IS '创建时间';
COMMENT ON COLUMN "public"."sys_routes"."update_time" IS '更新时间';
COMMENT ON TABLE "public"."sys_routes" IS '系统路由权限表';

-- ----------------------------
-- Indexes structure for table sys_routes
-- ----------------------------
CREATE INDEX "idx_parent_id" ON "public"."sys_routes" USING btree (
  "parent_id" "pg_catalog"."int4_ops" ASC NULLS LAST
);

-- ----------------------------
-- Uniques structure for table sys_routes
-- ----------------------------
ALTER TABLE "public"."sys_routes" ADD CONSTRAINT "uniq_route_name" UNIQUE ("name");

-- ----------------------------
-- Primary Key structure for table sys_routes
-- ----------------------------
ALTER TABLE "public"."sys_routes" ADD CONSTRAINT "sys_route_pkey" PRIMARY KEY ("id");
