liujiangyong
2 years ago
9 changed files with 239 additions and 249 deletions
@ -0,0 +1,52 @@ |
|||
/* eslint-disable*/ |
|||
'use strict'; |
|||
|
|||
module.exports = dc => { |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const UserResource = sequelize.define("userResource", { |
|||
id: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true, |
|||
unique: "post_resource_id_uindex" |
|||
}, |
|||
userId: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "user_id", |
|||
autoIncrement: false, |
|||
references: { |
|||
key: "id", |
|||
model: "post" |
|||
} |
|||
}, |
|||
resourceId: { |
|||
type: DataTypes.STRING, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: false, |
|||
field: "resource", |
|||
autoIncrement: false, |
|||
references: { |
|||
key: "code", |
|||
model: "resource" |
|||
} |
|||
} |
|||
}, { |
|||
tableName: "user_resource", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
|
|||
dc.models.UserResource = UserResource; |
|||
return UserResource; |
|||
}; |
@ -0,0 +1 @@ |
|||
INSERT INTO "public"."user" VALUES (1, '管理员', 'SuperAdmin', 'e10adc3949ba59abbe56e057f20f883e', 1, NULL, 't', 'f', '123456789', NULL); |
@ -0,0 +1,75 @@ |
|||
DROP SEQUENCE if EXISTS "public"."user_id_seq"; |
|||
CREATE SEQUENCE "public"."user_id_seq" |
|||
INCREMENT 1 |
|||
MINVALUE 1 |
|||
MAXVALUE 9223372036854775807 |
|||
START 1 |
|||
CACHE 1; |
|||
DROP TABLE IF EXISTS "public"."user"; |
|||
CREATE TABLE "public"."user" ( |
|||
"id" int4 NOT NULL DEFAULT nextval('user_id_seq'::regclass), |
|||
"name" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, |
|||
"username" varchar(64) COLLATE "pg_catalog"."default" NOT NULL, |
|||
"password" varchar(512) COLLATE "pg_catalog"."default" NOT NULL, |
|||
"department_id" int4 NOT NULL, |
|||
"email" varchar(128) COLLATE "pg_catalog"."default", |
|||
"enable" bool NOT NULL DEFAULT true, |
|||
"delete" bool NOT NULL DEFAULT false, |
|||
"phone" varchar(20) COLLATE "pg_catalog"."default" NOT NULL, |
|||
"post" varchar(64) COLLATE "pg_catalog"."default" |
|||
); |
|||
COMMENT ON COLUMN "public"."user"."username" IS '用户名 账号'; |
|||
COMMENT ON COLUMN "public"."user"."department_id" IS '部门id'; |
|||
COMMENT ON COLUMN "public"."user"."enable" IS '启用状态'; |
|||
COMMENT ON COLUMN "public"."user"."phone" IS '手机号(小程序使用手机号登录)'; |
|||
COMMENT ON COLUMN "public"."user"."post" IS '职位'; |
|||
|
|||
|
|||
DROP TABLE IF EXISTS "public"."resource"; |
|||
CREATE TABLE "public"."resource" ( |
|||
"code" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, |
|||
"name" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, |
|||
"parent_resource" varchar(128) COLLATE "pg_catalog"."default" |
|||
); |
|||
COMMENT ON TABLE "public"."resource" IS '权限字典'; |
|||
|
|||
|
|||
DROP SEQUENCE if EXISTS "public"."user_resource_id_seq"; |
|||
CREATE SEQUENCE "public"."user_resource_id_seq" |
|||
INCREMENT 1 |
|||
MINVALUE 1 |
|||
MAXVALUE 9223372036854775807 |
|||
START 1 |
|||
CACHE 1; |
|||
DROP TABLE IF EXISTS "public"."user_resource"; |
|||
CREATE TABLE "public"."user_resource" ( |
|||
"id" int4 NOT NULL DEFAULT nextval('user_resource_id_seq'::regclass), |
|||
"user_id" int4 NOT NULL, |
|||
"resource" varchar(128) COLLATE "pg_catalog"."default" NOT NULL |
|||
); |
|||
|
|||
|
|||
DROP TABLE IF EXISTS "public"."user_token"; |
|||
CREATE TABLE "public"."user_token" ( |
|||
"token" uuid NOT NULL, |
|||
"user_info" jsonb NOT NULL, |
|||
"expired" timestamptz(6) NOT NULL |
|||
); |
|||
|
|||
|
|||
DROP SEQUENCE if EXISTS "public"."department_id_seq"; |
|||
CREATE SEQUENCE "public"."department_id_seq" |
|||
INCREMENT 1 |
|||
MINVALUE 1 |
|||
MAXVALUE 9223372036854775807 |
|||
START 1 |
|||
CACHE 1; |
|||
DROP TABLE IF EXISTS "public"."department"; |
|||
CREATE TABLE "public"."department" ( |
|||
"id" int4 NOT NULL DEFAULT nextval('department_id_seq'::regclass), |
|||
"name" varchar(128) COLLATE "pg_catalog"."default" NOT NULL, |
|||
"dependence" int4, |
|||
"type" int4 NOT NULL |
|||
); |
|||
COMMENT ON COLUMN "public"."department"."dependence" IS '上级部门/从属'; |
|||
-- COMMENT ON COLUMN "public"."department"."type" IS '市1,区县2,乡镇3,村4'; |
Loading…
Reference in new issue