346 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			346 lines
		
	
	
		
			12 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| Project Management {
 | |
|   database_type: 'Postgresql'
 | |
|   Note: '''
 | |
|     # Management Database
 | |
|   '''
 | |
| }
 | |
| 
 | |
| Table "sys_user" {
 | |
|   "id" SERIAL [not null, increment]
 | |
|   "uuid" uuid [not null]
 | |
|   "email" VARCHAR(100) [not null, note: '邮箱地址']
 | |
|   "username" VARCHAR(100) [not null, note: '用户名称']
 | |
|   "hashed_password" bytea [not null, note: '加密密码']
 | |
|   "salt" VARCHAR(20) [not null, note: '密码盐值']
 | |
|   "avatar" VARCHAR(200) [not null, note: '头像']
 | |
|   "gender" INT [not null, default: 0, note: '性别']
 | |
|   "department_id" INT [not null, default: 0, note: '部门']
 | |
|   "role_id" INT [not null, default: 0, note: '角色']
 | |
|   "status" INT [not null, default: 0, note: '状态']
 | |
|   "change_password_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '密码修改时间']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
| 
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     uuid [unique]
 | |
|     username [unique]
 | |
|     email [unique]
 | |
|     status
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "sys_user_login_log" {
 | |
|   "id" BIGSERIAL [not null, increment]
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "email" VARCHAR(100) [not null, note: '邮箱地址']
 | |
|   "username" VARCHAR(100) [not null, note: '用户名称']
 | |
|   "user_uuid" uuid [not null, note: '用户uuid']
 | |
|   "is_success" Boolean [not null, note: '是否登陆成功']
 | |
|   "message" VARCHAR(300) [not null, note: '登陆消息']
 | |
|   "referer_url" VARCHAR(500) [not null, note: '上一个链接']
 | |
|   "url" VARCHAR(500) [not null, note: '链接']
 | |
|   "os" VARCHAR(50) [not null, note: '系统']
 | |
|   "ip" VARCHAR(20) [not null, note: 'ip']
 | |
|   "browser" VARCHAR(100) [not null, note: '浏览器']
 | |
| 
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     created_at
 | |
|     email
 | |
|     username
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "sys_audit_log" {
 | |
|   "id" BIGSERIAL [not null, increment]
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "email" VARCHAR(100) [not null, note: '邮箱地址']
 | |
|   "username" VARCHAR(100) [not null, note: '用户名称']
 | |
|   "user_uuid" uuid [not null, note: '用户uuid']
 | |
|   "start_at" TIMESTAMPTZ [not null, note: '请求开始时间']
 | |
|   "end_at" TIMESTAMPTZ [not null, note: '请求结束时间']
 | |
|   "duration" VARCHAR(10) [not null, note: '请求总时间']
 | |
|   "url" VARCHAR(500) [not null, note: '请求链接']
 | |
|   "method" VARCHAR(50) [not null, note: '请求类型']
 | |
|   "parameters" VARCHAR [not null, note: '请求参数']
 | |
|   "referer_url" VARCHAR(500) [not null, note: '上一个链接']
 | |
|   "os" VARCHAR(50) [not null, note: '系统']
 | |
|   "ip" VARCHAR(20) [not null, note: 'ip']
 | |
|   "browser" VARCHAR(100) [not null, note: '浏览器']
 | |
|   "remark" VARCHAR(300) [not null, note: '备注']
 | |
| 
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     created_at
 | |
|     email
 | |
|     username
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "sessions" {
 | |
| 	"token" TEXT [not null, note: 'token']
 | |
| 	"data" BYTEA [not null, note: 'data']
 | |
| 	"expiry" TIMESTAMPTZ [not null, note: 'expiry']
 | |
| 
 | |
|   Indexes {
 | |
|     token [pk]
 | |
|     expiry
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "sys_department" {
 | |
|   "id" SERIAL [not null, increment]
 | |
|   "name" VARCHAR(200) [not null, note: '部门名称']
 | |
|   "parent_id" INT [not null, note: '上级id']
 | |
|   "parent_path" VARCHAR(500) [not null, note: '树路径']
 | |
|   "status" INT [not null, default: 0, note: '状态']
 | |
|   "sort" INT [not null, default: 0, note: '排序']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
| 
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     name [unique]
 | |
|     status
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "sys_role" {
 | |
|   "id" SERIAL [not null, increment]
 | |
|   "name" VARCHAR(200) [not null, note: '名称']
 | |
|   "display_name" VARCHAR(200) [not null, note: '显示名称']
 | |
|   "parent_id" INT [not null, note: '上级id']
 | |
|   "parent_path" VARCHAR(500) [not null, note: '树路径']
 | |
|   "vip" Boolean [not null, note: '是否vip']
 | |
|   "status" INT [not null, default: 0, note: '状态']
 | |
|   "sort" INT [not null, default: 0, note: '排序']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
| 
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     name [unique]
 | |
|     display_name [unique]
 | |
|     status
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "sys_menu" {
 | |
|   "id" SERIAL [not null, increment]
 | |
|   "name" VARCHAR(200) [not null, note: '名称']
 | |
|   "display_name" VARCHAR(200) [not null, note: '显示名称']
 | |
|   "url" VARCHAR(200) [not null, note: '菜单url']
 | |
|   "type" VARCHAR(50) [not null, note: '菜单类型(node, menu, btn)']
 | |
|   "parent_id" INT [not null, note: '上级id']
 | |
|   "parent_path" VARCHAR(500) [not null, note: '树路径']
 | |
|   "avatar" VARCHAR(100) [not null, note: '菜单图标']
 | |
|   "style" VARCHAR(100) [not null, note: '菜单样式']
 | |
|   "visible" Boolean [not null, note: '是否可见']
 | |
|   "is_list" Boolean [not null, note: '是否列表']
 | |
|   "status" INT [not null, default: 0, note: '状态']
 | |
|   "sort" INT [not null, default: 0, note: '排序']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
| 
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     url [unique]
 | |
|     type
 | |
|     parent_id
 | |
|     status
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "sys_role_menu" {
 | |
|   "role_id" INT [not null, note: '角色id']
 | |
|   "menu_id" INT [not null, note: '菜单id']
 | |
| 
 | |
|   Indexes {
 | |
|     role_id menu_id [pk]
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "sys_config" {
 | |
|   "id" SERIAL [not null, increment]
 | |
|   "key" VARCHAR(100) [not null, note: '存储键']
 | |
|   "value" jsonb [not null, note: '存储值']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
| 
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     key [unique]
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "categories" {
 | |
|   "id" SERIAL [not null, increment, note: 'ID']
 | |
|   "name" VARCHAR(100) [not null, note: '名称']
 | |
|   "icon" VARCHAR(300) [not null, default: '', note: '图标']
 | |
|   "description" VARCHAR(500) [not null, default: '', note: '描述']
 | |
|   "letter" VARCHAR(100) [not null, default: '', note: '拼音']
 | |
|   "parent_id" INT [not null, default: 0, note: '父级ID']
 | |
|   "parent_path" VARCHAR(500) [not null, default: '', note: '树路径']
 | |
|   "status" SMALLINT [not null, default: 0, note: '状态']
 | |
|   "sort" INT [not null, default: 0, note: '排序']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
|   
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     name
 | |
|     letter [unique]
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "customers" {
 | |
|   "id" BIGINT [not null, note: 'ID']
 | |
|   "name" VARCHAR(100) [not null, note: '名称']
 | |
|   "category" INT [not null, default: 0, note: '类别']
 | |
|   "source" INT [not null, default: 0, note: '来源']
 | |
|   "address" VARCHAR(500) [not null, default: '', note: '地址']
 | |
|   "contact_name" VARCHAR(100) [not null, default: '', note: '主要联系人']
 | |
|   "contact_phone" VARCHAR(50) [not null, default: '', note: '主要联系人手机']
 | |
|   "status" SMALLINT [not null, default: 0, note: '状态']
 | |
|   "sort" INT [not null, default: 0, note: '排序']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "created_by" INT [not null, default: 0, note: '创建人']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
|   "updated_by" INT [not null, default: 0, note: '更新人']
 | |
|   
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     name
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "customer_contact" {
 | |
|   "id" SERIAL [not null, increment, note: 'ID']
 | |
|   "name" VARCHAR(100) [not null, note: '名称']
 | |
|   "telephone" VARCHAR(50) [not null, note: '联系方式']
 | |
|   "customer_id" BIGINT [not null, note: '客户ID']
 | |
|   "status" SMALLINT [not null, default: 0, note: '状态']
 | |
|   "sort" INT [not null, default: 0, note: '排序']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "created_by" INT [not null, default: 0, note: '创建人']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
|   "updated_by" INT [not null, default: 0, note: '更新人']
 | |
|   
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     name
 | |
|     telephone
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "projects" {
 | |
|   "id" BIGINT [not null, note: 'ID']
 | |
|   "name" VARCHAR(100) [not null, note: '名称']
 | |
|   "start_at" TIMESTAMPTZ [not null, note: '开始时间']
 | |
|   "end_at" TIMESTAMPTZ [not null, note: '结束时间']
 | |
|   "customer_id" BIGINT [not null, note: '客户ID']
 | |
|   "total_money" DECIMAL(10, 2) [not null, default: 0, note: '总金额']
 | |
|   "description" VARCHAR(500) [not null, default: '', note: '简介']
 | |
|   "apply_at" TIMESTAMPTZ [not null, note: '申请时间']
 | |
|   "apply_user_id" INT [not null, note: '申请人']
 | |
|   "manager_id" INT [not null, note: '项目经理']
 | |
|   "members" VARCHAR(1000) [not null, note: '项目成员']
 | |
|   "status" SMALLINT [not null, default: 0, note: '状态']
 | |
|   "sort" INT [not null, default: 0, note: '排序']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "created_user_id" INT [not null, default: 0, note: '创建人']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
|   "updated_user_id" INT [not null, default: 0, note: '更新人']
 | |
|   
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     name
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "project_files" {
 | |
|   "id" BIGINT [not null, note: 'ID']
 | |
|   "name" VARCHAR(100) [not null, note: '名称']
 | |
|   "path" VARCHAR(500) [not null, note: '路径']
 | |
|   "project_id" BIGINT [not null, note: '项目ID']
 | |
|   "sort" INT [not null, default: 0, note: '排序']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "created_user_id" INT [not null, default: 0, note: '创建人']
 | |
|   
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     name
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "budgets" {
 | |
|   "id" BIGSERIAL [not null, note: 'ID']
 | |
|   "project_id" BIGINT [not null, note: '项目ID']
 | |
|   "name" VARCHAR(100) [not null, note: '名称']
 | |
|   "budget_type" INT [not null, note: '预算类型: 收入/支出']
 | |
|   "category" INT [not null, note: '类别']
 | |
|   "start_at" TIMESTAMPTZ [not null, note: '开始时间']
 | |
|   "end_at" TIMESTAMPTZ [not null, note: '结束时间']
 | |
|   "amount" DECIMAL(10, 2) [not null, default: 0, note: '预算金额']
 | |
|   "used_amount" DECIMAL(10, 2) [not null, default: 0, note: '已使用金额']
 | |
|   "remaining_amount" DECIMAL(10, 2) [not null, default: 0, note: '剩余金额']
 | |
|   "remark" VARCHAR(500) [not null, default: '', note: '备注']
 | |
|   "status" SMALLINT [not null, default: 0, note: '状态']
 | |
|   "sort" INT [not null, default: 0, note: '排序']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "created_user_id" INT [not null, default: 0, note: '创建人']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
|   "updated_user_id" INT [not null, default: 0, note: '更新人']
 | |
|   
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     project_id
 | |
|     category
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "incomes" {
 | |
|   "id" BIGSERIAL [not null, note: 'ID']
 | |
|   "project_id" BIGINT [not null, note: '项目ID']
 | |
|   "budget_id" BIGINT [not null, default: 0, note: '预算ID']
 | |
|   "amount" DECIMAL(10, 2) [not null, default: 0, note: '收入金额']
 | |
|   "income_at" TIMESTAMPTZ [not null, note: '收入时间']
 | |
|   "income_type" INT [not null, note: '收入类型']
 | |
|   "income_bank" INT [not null, note: '收入银行']
 | |
|   "remark" VARCHAR(500) [not null, default: '', note: '备注']
 | |
|   "status" SMALLINT [not null, default: 0, note: '状态']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "created_user_id" INT [not null, default: 0, note: '创建人']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
|   "updated_user_id" INT [not null, default: 0, note: '更新人']
 | |
|   
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     project_id
 | |
|     budget_id
 | |
|     income_type
 | |
|   }
 | |
| }
 | |
| 
 | |
| Table "expenses" {
 | |
|   "id" BIGSERIAL [not null, note: 'ID']
 | |
|   "project_id" BIGINT [not null, note: '项目ID']
 | |
|   "budget_id" BIGINT [not null, default: 0, note: '预算ID']
 | |
|   "amount" DECIMAL(10, 2) [not null, default: 0, note: '支出金额']
 | |
|   "expenses_at" TIMESTAMPTZ [not null, note: '支出时间']
 | |
|   "expenses_type" INT [not null, note: '支出类型']
 | |
|   "remark" VARCHAR(500) [not null, default: '', note: '备注']
 | |
|   "status" SMALLINT [not null, default: 0, note: '状态']
 | |
|   "created_at" TIMESTAMPTZ [not null, default: `NOW()`, note: '创建时间']
 | |
|   "created_user_id" INT [not null, default: 0, note: '创建人']
 | |
|   "updated_at" TIMESTAMPTZ [not null, default: `'0001-01-01 00:00:00+8'`, note: '更新时间']
 | |
|   "updated_user_id" INT [not null, default: 0, note: '更新人']
 | |
|   
 | |
|   Indexes {
 | |
|     id [pk]
 | |
|     project_id
 | |
|     budget_id
 | |
|     expenses_type
 | |
|   }
 | |
| } |