-- public.sys_group definition

-- Drop table

-- DROP TABLE public.sys_group;

CREATE TABLE public.sys_group (
	id serial4 NOT NULL,
	create_time timestamp NULL,
	creator_id int4 NULL,
	site_num varchar(255) NULL,
	update_time timestamp NULL,
	updater_id int4 NULL,
	app_module_id int4 NULL,
	description varchar(255) NULL,
	group_name varchar(255) NULL,
	CONSTRAINT sys_group_pkey PRIMARY KEY (id),
	CONSTRAINT 用户组名称不能重复 UNIQUE (group_name)
)
WITH (
	orientation=row,
	compression=no
);

CREATE TABLE public.sys_user (
	id serial4 NOT NULL,
	create_time timestamp NULL,
	creator_id int4 NULL,
	site_num varchar(255) NULL,
	update_time timestamp NULL,
	updater_id int4 NULL,
	app_module_id int4 NULL,
	birthday date NULL,
	cas_id int8 NULL,
	client_module_id int4 NULL,
	department_id int4 NULL,
	description varchar(255) NULL,
	email varchar(255) NULL,
	gender int4 NULL,
	head_icon varchar(100) NULL,
	mobile_phone varchar(255) NULL,
	module_id int4 NULL,
	"position" varchar(255) NULL,
	security_level int4 NULL,
	sort_code int4 NULL,
	user_account varchar(200) NULL,
	user_name varchar(20) NULL,
	wechat varchar(255) NULL,
	group_id int4 NULL,
	CONSTRAINT sys_user_department_id_check CHECK ((department_id >= 0)),
	CONSTRAINT sys_user_gender_check CHECK (((gender >= 1) AND (gender <= 2))),
	CONSTRAINT sys_user_pkey PRIMARY KEY (id),
	CONSTRAINT fkl7i4833vinxhaeho5oynrsjtk FOREIGN KEY (group_id) REFERENCES public.sys_group(id)
)
WITH (
	orientation=row,
	compression=no
);



INSERT INTO public.sys_user (create_time,creator_id,site_num,update_time,updater_id,app_module_id,birthday,cas_id,client_module_id,department_id,description,email,gender,head_icon,mobile_phone,module_id,"position",security_level,sort_code,user_account,user_name,wechat,group_id) VALUES
	 ('2025-04-21 13:34:33.252982',1,NULL,'2025-04-21 13:41:29.984',NULL,NULL,'2025-04-21',1,NULL,0,'','dev@h-visions.com',1,'','',NULL,'',1,1,'admin','管理员','',NULL);
