Database design of working single module __ Database

Source: Internet
Author: User
Tags add time field table

Workflow is the flow of business information data between modules in multiple links. As defined by the Workflow Management Alliance, workflows refer to "The automation of part or all of a business process in a computer application environment". In the practical application process, in order to realize the workflow management of the business process, it is necessary to abstract and generalize the business rules between the business process and each step, and make a unified general process management software system, which is the workflow management system.

The company requires a work order system to be done in a workflow manner. In the beginning, because there is no contact with workflow mechanism, complete understanding of the error, the first version of the design is not the way the workflow. Later on the Internet query learning, see Workflow Open Source Engine documentation, only slowly have an understanding. Then spent a period of time to do a prototype diagram design document, sent to the supervisor to see. They do not know when the discussion, only to tell me too complex, to "click" Off. Hearing this reply, I am not surprised, the heart is just a little disappointed. From the beginning said to do, to the process of learning design, to the final prototype figure out, but also spent a lot of time. Not surprised, because, understand the workflow mechanism, found that to do a perfect point of the better workflow mechanism is very complex, especially to use the work of the module. This complexity may not outweigh the risks of later maintenance. Those who do not understand the work flow, maintenance will also confused. Online Search work orders workflow, found that the original graduate thesis is also engaged in a thing, so I thought, if I made this, I have at least graduate. And I always want to try to do something new something difficult, always repeat do those list add modify query, boring, completely meaningless. In assessing the feasibility of this work-list workflow, there is a point of selfishness, do not want to manage the later maintenance of the matter, to say. When you do it, you get some very rare experiences. Other companies in web development do not know how to use workflow this way to work a single module is not much, it should not feel much.


The following is the design of the database, did not actually do development. But it should be able to meet the workflow. The index hasn't been done yet.


CREATE TABLE ' workflow_baseinfo ' (
  ' id ' int () not NULL auto_increment COMMENT ' serial number ',
  ' wb_name ' varchar () not N ull COMMENT ' process name ',
  ' wb_desc ' varchar (watts) DEFAULT NULL COMMENT ' process description ',
  ' wb_type ' tinyint (1) Not NULL DEFAULT '-1 ' COMMENT ' is a sub-process (1 is-1 no) ',
  ' wb_searcher ' varchar (1000) DEFAULT NULL COMMENT ' Process Management monitor Person ID (multiple comma separated) ',
  ' wb_ Queryer ' varchar (1000) DEFAULT null COMMENT ' process query Person ID (multiple comma separated) ',
  ' wb_status ' int (2) NOT null DEFAULT ' 1 ' COMMENT ' process run State (-1 Deactivate 1 enabled) ',
  ' wb_limit_minute ' int (one) DEFAULT null COMMENT ' process Limited (minutes) ',
  ' wb_add_user_id ' int (one) NOT NULL COMMENT ' This record add person ',
  ' wb_add_time ' int (one) not NULL COMMENT ' add time for this record ',
  PRIMARY KEY (' id ')
engine=myisam DEFAULT Charset=utf8 comment= ' Workflow property sheet '

CREATE TABLE ' workflow_step ' (' id ' int (one) not NULL auto_increment COMMENT ' serial number ', ' ws_baseinfo_id ' int (one) not null C Omment ' Workflow property sheet ID ', ' ws_name ' varchar ' NOT null COMMENT ' name ', ' ws_desc ' varchar (watts) DEFAULT NULL COMMENT ' description ', '
  Ws_order ' int (3) DEFAULT null COMMENT ' ordinal ', ' ws_is_runer ' tinyint (1) Not NULL DEFAULT '-1 ' COMMENT ' need to designate the handler (1 is-1 no) ', ' ws_run_user_id ' varchar default null COMMENT ' handling owner (User ID) ', ' ws_run_role_id ' varchar (MB) default null COMMENT '  Run owner (role ID) ', ' ws_run_department_id ' varchar (MB) DEFAULT null COMMENT ' handling owner (department ID) ', ' ws_run_type ' tinyint (1) NOT NULL DEFAULT ' 1 ' COMMENT ' execution type (1 artificial node 2 automatic node) ', ' ws_notice_sms ' tinyint (1) Not NULL DEFAULT '-1 ' COMMENT ' Whether SMS notification (-1 No 1 is) ', ' ws _notice_email ' tinyint (1) NOT null DEFAULT '-1 ' COMMENT ' whether mail notification (-1 No 1 is) ', ' ws_type ' tinyint (1) NOT NULL COMMENT ' node type (1 starts  Node 2 End node 3 process nodes) ', ' ws_limit_time ' int (one) default null COMMENT ' Time (sec) ', ' ws_int_api_id ' varchar DEFAULT null COMMENT
  ' Node initial event ID (multiple comma delimited) ',The ' ws_run_api_id ' varchar DEFAULT null COMMENT ' node runs an event ID (multiple comma-delimited) ', ' ws_save_api_id ' varchar ' not NULL COMMENT ' node security Save Event ID (multiple comma delimited) ', ' ws_turn_api_id ' varchar DEFAULT NULL COMMENT ' node flow event ID (multiple comma delimited) ', ' Ws_is_sync ' tinyint (1) Not NU LL DEFAULT ' 1 ' COMMENT ' is synchronized (1 is-1 no) ', ' ws_add_user_id ' int (one) DEFAULT NULL COMMENT ' This record add Person id ', ' ws_add_time ' int (11) Default NULL COMMENT ' This record add time ', ' ws_son_baseinfo_id ' int (one) DEFAULT null COMMENT ' child workflow id ', ' ws_listpage_show ' tinyint (1) The Not NULL DEFAULT '-1 ' COMMENT ' list is a visible field ID in the current node that displays the action (1 is-1 no) ', ' ws_show_fields ' varchar ' DEFAULT NULL COMMENT ' (multiple Comma delimited) ', ' ws_edit_fields ' varchar DEFAULT NULL COMMENT ' The field IDs edited in the current node (multiple comma delimited), PRIMARY KEY (' id ') Engine=myisa
 M DEFAULT Charset=utf8 comment= ' Workflow node step table '

CREATE TABLE ' workflow_line ' (
  ' id ' int (one) not NULL auto_increment COMMENT ' serial number ',
  ' wl_start_step_id ' int (one) not Null COMMENT ' line start Node ID ',
  ' wl_end_step_id ' int (one) not NULL COMMENT ' line end Node ID ',
  PRIMARY KEY (' id ')
engine=m Yisam DEFAULT Charset=utf8 comment= ' Workflow Line table '

CREATE TABLE ' workflow_fields ' (' id ' int (one) not NULL auto_increment COMMENT ' serial number ', ' wf_baseinfo_id ' int (one) NOT NULL COMMENT ' Workflow property sheet ID ', ' wf_step_id ' int (one) DEFAULT null COMMENT ' workflow node table ID ', ' wf_cnname ' varchar ' not NULL COMMENT ' table 
  Chinese name ', ' wf_enname ' varchar (a) default null COMMENT ' form field English name ', ' wf_desc ' varchar (MB) default null COMMENT ' field Memo ', ' Wf_default_value ' varchar (1000) default null COMMENT ' field defaults ', ' wf_searchpage_show ' tinyint (1) NOT null default ' 1 ' C Omment ' Query whether the page is viewable (1 is-1 no) ', ' wf_addpage_show ' tinyint (1) Not NULL DEFAULT ' 1 ' COMMENT ' adds whether the page is visible (1 is-1 no) ', ' Wf_editpage_sh ow ' tinyint (1) NOT null default ' 1 ' COMMENT ' edit page viewable (1 is-1 no) ', ' wf_listpage_show ' tinyint (1) NOT null default ' 1 ' commen T ' list page is viewable (1 is-1 no) ', ' wf_is_empty ' tinyint (1) NOT null DEFAULT '-1 ' COMMENT ' Can be empty (1 is-1 no) ', ' wf_is_edit ' tinyint (1) N OT null default ' 1 ' COMMENT ' is editable (1 is-1 no) ', ' Wf_is_global ' tinyint (1) NOT NULL default '-1 ' COMMENT ' whether global variable (1 is-1 no) ', ' Wf_type ' tinyint (1) notNull default ' 1 ' COMMENT ' field Display Type (1 edit box 2 Radio Box 3 multi-selection box 4 dropdown box 5 text box) ', ' wf_value_type ' tinyint (1) Not NULL default ' 1 ' COMMENT ' numeric type (1
String 2 numeric Type 3 only allowed in English 4 email type 5datetime) ', ' Wf_link_type ' int (5) DEFAULT NULL COMMENT ' Association multiple value type (1 Department 2 role) ', PRIMARY KEY (' id ')
 Engine=myisam DEFAULT charset=utf8 comment= ' form Field table '

CREATE TABLE ' workflow_option ' (
  ' id ' int (one) not NULL auto_increment COMMENT ' serial number ',
  ' wo_fields_id ' int (one) not NU LL COMMENT ' Field table ID ',
  ' wo_key ' varchar () NOT NULL COMMENT ' option ID ',
  ' wo_value ' varchar ' (MB) NOT null COMMENT ' option value ' C4/>primary KEY (' id ')
) Engine=myisam DEFAULT charset=utf8 comment= ' Custom option Data '

CREATE TABLE ' workflow_rule ' (
  ' id ' int (one) not NULL auto_increment COMMENT ' serial number ',
  ' wr_line_id ' int (one) not null C Omment ' work Streamline path ID ',
  ' wr_field_name ' varchar (#) DEFAULT NULL COMMENT ' Variable field table ID ',
  ' wr_param_name ' varchar (30) Default NULL COMMENT ' parameter value ',
  ' wr_rule ' tinyint (1) DEFAULT null COMMENT ' relation to parameter value (1 is greater than 2 less than 3 is equal to 4 greater than or equal to 5 is less than or equal to 6 contains 7 does not contain) ',
  ' wr_type ' tinyint (1) Not NULL DEFAULT '-1 ' COMMENT ' rule type, custom rule (1 is-1 no) ',
  ' wr_custom_rule ' text COMMENT ' Contents of the custom rule ',
  ' wr_desc ' varchar (+) default NULL COMMENT ' rule description ',
  PRIMARY KEY (' id ')
engine=myisam default Charset=utf8 comment= ' Workflow rules table '

CREATE TABLE ' Workflow_api ' (
  ' id ' int () NOT NULL auto_increment COMMENT ' serial number ',
  ' wa_name ' varchar () NOT NULL C Omment ' interface name ',
  ' wa_desc ' varchar (+) DEFAULT null COMMENT ' interface description ',
  ' wa_path ' varchar (1000) not NULL COMMENT ' interface path ',
  ' wa_module_name ' varchar DEFAULT null COMMENT ' module name ',
  ' wa_function_name ' varchar ' not NULL COMMENT ' Execute function name ',
  PRIMARY KEY (' id ')
) Engine=myisam DEFAULT charset=utf8 comment= ' Workflow Event table '

CREATE TABLE ' workflow_api_fields ' (
  ' id ' int (one) not NULL auto_increment COMMENT ' serial number ',
  ' waf_api_id ' int (one) not Null COMMENT ' interface table ID ',
  ' waf_cn_name ' varchar ' NOT null COMMENT ' Chinese name ',
  ' waf_en_name ' varchar ' (NOT NULL comme NT ' English name ',
  ' waf_value_type ' tinyint (1) Not NULL DEFAULT ' 1 ' COMMENT ' variable type (1 character 2 numeric type 3 Boolean 4 array type) ',
  ' Waf_defalue_ Value ' text COMMENT ' variable default ',
  ' waf_fields_to ' int (one) default NULL COMMENT ' interface variable corresponding to field variable table ID ',
  ' waf_desc ' varchar ( Default NULL COMMENT ' variable description ',
  PRIMARY KEY (' id ')
) engine=myisam default Charset=utf8 comment= ' interface variable table '

CREATE TABLE ' workflow_instance ' (
  ' id ' int (one) not NULL auto_increment COMMENT ' serial number ',
  ' wi_baseinfo_id ' int (one) N OT null COMMENT ' workflow property sheet ID ',
  ' wi_name ' varchar (MB) NOT null COMMENT ' instance name ',
  ' wi_status ' tinyint (1) NOT NULL Defaul T ' 1 ' COMMENT ' state (-1 not started 1 start 2 running 3 end) ',
  ' wi_run_user_id ' int (one) DEFAULT NULL COMMENT ' instance initiator ID ',
  ' wi_run_time ' int (one) default NULL COMMENT ' Start time ',
  PRIMARY KEY (' id ')
) engine=myisam default Charset=utf8 comment= ' Workflow instance table '

CREATE TABLE ' Workflow_instance_datas ' (
  ' id ' int (one) not NULL auto_increment COMMENT ' serial number ',
  ' wif_instance_id ' Int (one) not null COMMENT ' workflow instance ID ',
  ' wif_fields_id ' int (one) not null COMMENT ' form Field table ID ',
  ' wif_data ' varchar ( 1000) Default NULL COMMENT ' field value ',
  PRIMARY KEY (' id ')
engine=myisam default Charset=utf8 comment= ' form datasheet '

CREATE TABLE ' workflow_instance_step ' (
  ' id ' int (one) not NULL auto_increment COMMENT ' serial number ',
  ' wis_instance_id ' Int (one) not null COMMENT ' workflow instance table ID ',
  ' wis_step_id ' int (one) not null COMMENT ' node step id ',
  ' wis_run_user_id ' int (one) D Efault null COMMENT ' executor ID (-1 for System) ',
  ' wis_run_start_time ' int (one) DEFAULT NULL COMMENT ' execution start time ',
  ' Wis_run_end_ Time ' int (one) default NULL COMMENT ' execution end Times ',
  ' wis_status ' tinyint (1) Default ' 1 ' COMMENT ' state (1 execution 2 closed) ',
  ' Wis_ Turn_desc ' varchar (1000) default null COMMENT ' Flow Memo ',
  ' wis_accept_user_id ' int (one) default null COMMENT ' Receiver ID (-1 for System) ',
  PRIMARY KEY (' id ')
engine=myisam DEFAULT Charset=utf8 comment= ' Instance node step table '

CREATE TABLE ' workflow_log_instance_step ' (
  ' id ' int (one) not NULL auto_increment COMMENT ' serial number ',
  ' Wlis_instance_ ID ' int (one) not null COMMENT ' workflow instance table ID ',
  ' wlis_step_id ' int (one) not null COMMENT ' node step id ',
  ' wlis_run_user_id ' int (one) default null COMMENT ' Executor ID (-1 for System) ',
  ' wlis_run_start_time ' int (one) default null COMMENT ' execution start time ',
  ' Wlis_ Run_end_time ' int (one) default NULL COMMENT ' execution end time ',
  ' wlis_status ' tinyint (1) Default ' 1 ' COMMENT ' status (1 execution 2 closed) ', 
   ' wlis_runback_step_id ' int (one) default null COMMENT ' fallback to step id ',
  ' wlis_runback_desc ' varchar (=) default null COMMENT ' fallback description ',
  PRIMARY KEY (' id ')
engine=myisam DEFAULT Charset=utf8 comment= ' node step log table '



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.