巴林闲侠
2 years ago
6 changed files with 227 additions and 14 deletions
@ -0,0 +1,103 @@ |
|||
/* eslint-disable*/ |
|||
|
|||
'use strict'; |
|||
|
|||
module.exports = dc => { |
|||
const DataTypes = dc.ORM; |
|||
const sequelize = dc.orm; |
|||
const Workorder = sequelize.define("workorder", { |
|||
id: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: null, |
|||
primaryKey: true, |
|||
field: "id", |
|||
autoIncrement: true, |
|||
unique: "workorder_id_uindex" |
|||
}, |
|||
storyId: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: false, |
|||
defaultValue: null, |
|||
comment: "项企工作流的 history_id 实例id", |
|||
primaryKey: false, |
|||
field: "story_id", |
|||
autoIncrement: false, |
|||
unique: "workorder_story_id_uindex" |
|||
}, |
|||
pomsProjectId: { |
|||
type: DataTypes.INTEGER, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "运维的项目的id", |
|||
primaryKey: false, |
|||
field: "poms_project_id", |
|||
autoIncrement: false, |
|||
references: { |
|||
key: "id", |
|||
model: "projectCorrelation" |
|||
} |
|||
}, |
|||
expectTime: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "期望解决时间", |
|||
primaryKey: false, |
|||
field: "expect_time", |
|||
autoIncrement: false |
|||
}, |
|||
createTime: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "创建时间", |
|||
primaryKey: false, |
|||
field: "create_time", |
|||
autoIncrement: false |
|||
}, |
|||
completeTime: { |
|||
type: DataTypes.DATE, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "解决时间", |
|||
primaryKey: false, |
|||
field: "complete_time", |
|||
autoIncrement: false |
|||
}, |
|||
state: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "状态", |
|||
primaryKey: false, |
|||
field: "state", |
|||
autoIncrement: false |
|||
}, |
|||
problemType: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "问题类型", |
|||
primaryKey: false, |
|||
field: "problem_type", |
|||
autoIncrement: false |
|||
}, |
|||
solution: { |
|||
type: DataTypes.STRING, |
|||
allowNull: true, |
|||
defaultValue: null, |
|||
comment: "解决方案", |
|||
primaryKey: false, |
|||
field: "solution", |
|||
autoIncrement: false |
|||
} |
|||
}, { |
|||
tableName: "workorder", |
|||
comment: "", |
|||
indexes: [] |
|||
}); |
|||
dc.models.Workorder = Workorder; |
|||
return Workorder; |
|||
}; |
@ -0,0 +1,41 @@ |
|||
create table if not exists workorder |
|||
( |
|||
id serial not null |
|||
constraint workorder_pk |
|||
primary key, |
|||
story_id integer not null, |
|||
poms_project_id integer |
|||
constraint workorder_project_correlation_id_fk |
|||
references project_correlation, |
|||
expect_time timestamp with time zone, |
|||
create_time timestamp with time zone, |
|||
complete_time timestamp with time zone, |
|||
state varchar(64), |
|||
problem_type varchar(128), |
|||
solution varchar(128) |
|||
); |
|||
|
|||
comment on table workorder is '工单信息 定时任务采集自项企工作流'; |
|||
|
|||
comment on column workorder.story_id is '项企工作流的 history_id 实例id'; |
|||
|
|||
comment on column workorder.poms_project_id is '运维的项目的id'; |
|||
|
|||
comment on column workorder.expect_time is '期望解决时间'; |
|||
|
|||
comment on column workorder.create_time is '创建时间'; |
|||
|
|||
comment on column workorder.complete_time is '解决时间'; |
|||
|
|||
comment on column workorder.state is '状态'; |
|||
|
|||
comment on column workorder.problem_type is '问题类型'; |
|||
|
|||
comment on column workorder.solution is '解决方案'; |
|||
|
|||
create unique index if not exists workorder_id_uindex |
|||
on workorder (id); |
|||
|
|||
create unique index if not exists workorder_story_id_uindex |
|||
on workorder (story_id); |
|||
|
Loading…
Reference in new issue