初始化数据库
方法一:执行sql脚本文件
sql位置:activiti-6\database\create\activiti.mysql.create.*.sql文件
方法二:JAVA代码创建
import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngineConfiguration;
import org.junit.Test;
/**
* Activity 初始化
*
* @author Yang
*/
public class ActivitiInitTableTest {
@Test
public void init() {
//创建引擎配置对象
ProcessEngineConfiguration configration = ProcessEngineConfiguration.createStandaloneInMemProcessEngineConfiguration();
//创建流程引擎对象
//目标生成数据库表
configration.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/activiti?nullCatalogMeansCurrent=true");
configration.setJdbcDriver("com.mysql.cj.jdbc.Driver");
configration.setJdbcUsername("root");
configration.setJdbcPassword("root");
//设置表的生成策略
configration.setDatabaseSchemaUpdate(ProcessEngineConfiguration.DB_SCHEMA_UPDATE_TRUE);
ProcessEngine processEngine = configration.buildProcessEngine();
System.out.println(processEngine.getName());
}
}
增加mysql表注释字段注释
数据库字段说明:
地址1、 地址2、 地址3
把原文地址整理为了sql文件 。
例:
ALTER TABLE `act_hi_actinst`
MODIFY COLUMN `ID_` VARCHAR ( 64 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '主键ID' FIRST,
MODIFY COLUMN `PROC_DEF_ID_` VARCHAR ( 64 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '流程定义ID' AFTER `ID_`,
MODIFY COLUMN `PROC_INST_ID_` VARCHAR ( 64 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '流程实例ID' AFTER `PROC_DEF_ID_`,
MODIFY COLUMN `EXECUTION_ID_` VARCHAR ( 64 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '执行实例ID' AFTER `PROC_INST_ID_`,
MODIFY COLUMN `ACT_ID_` VARCHAR ( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '节点ID' AFTER `EXECUTION_ID_`,
MODIFY COLUMN `TASK_ID_` VARCHAR ( 64 ) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '任务实例ID' AFTER `ACT_ID_`,
MODIFY COLUMN `CALL_PROC_INST_ID_` VARCHAR ( 64 ) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '调用外部的流程实例ID' AFTER `TASK_ID_`,
MODIFY COLUMN `ACT_NAME_` VARCHAR ( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '节点名称' AFTER `CALL_PROC_INST_ID_`,
MODIFY COLUMN `ACT_TYPE_` VARCHAR ( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL COMMENT '节点类型' AFTER `ACT_NAME_`,
MODIFY COLUMN `ASSIGNEE_` VARCHAR ( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '签收人' AFTER `ACT_TYPE_`,
MODIFY COLUMN `START_TIME_` datetime ( 3 ) NOT NULL COMMENT '开始时间' AFTER `ASSIGNEE_`,
MODIFY COLUMN `END_TIME_` datetime ( 3 ) NULL DEFAULT NULL COMMENT '结束时间' AFTER `START_TIME_`,
MODIFY COLUMN `DURATION_` BIGINT ( 20 ) NULL DEFAULT NULL COMMENT '耗时,毫秒值' AFTER `END_TIME_`,
MODIFY COLUMN `DELETE_REASON_` VARCHAR ( 4000 ) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT NULL COMMENT '删除原因' AFTER `DURATION_`,
MODIFY COLUMN `TENANT_ID_` VARCHAR ( 255 ) CHARACTER SET utf8 COLLATE utf8_bin NULL DEFAULT '' COMMENT '租户ID' AFTER `DELETE_REASON_`,
COMMENT = '历史行为表';
PS:其他表注释请见资源文件
activiti学习文档
1、版本6官方API
2、Activiti6.0教程
3、Activiti6.0工作流使用说明文档v1.0.pdf
4、视频讲解 提取密码: r6pc