/*
 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 20:13:33
*/


-- ----------------------------
-- Table structure for user_role
-- ----------------------------
DROP TABLE IF EXISTS "public"."user_role";
CREATE TABLE "public"."user_role" (
  "id" int4 NOT NULL DEFAULT nextval('user_role_id_seq'::regclass),
  "user_id" int4 NOT NULL,
  "role_id" int4 NOT NULL,
  "created_at" timestamptz(6) DEFAULT now(),
  "updated_at" timestamptz(6) DEFAULT now()
)
;

-- ----------------------------
-- Triggers structure for table user_role
-- ----------------------------
CREATE TRIGGER "update_user_role_updated_at" BEFORE UPDATE ON "public"."user_role"
FOR EACH ROW
EXECUTE PROCEDURE "public"."update_updated_at"();

-- ----------------------------
-- Uniques structure for table user_role
-- ----------------------------
ALTER TABLE "public"."user_role" ADD CONSTRAINT "user_role_user_id_role_id_key" UNIQUE ("user_id", "role_id");

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