mirror of
https://github.com/getrebuild/rebuild.git
synced 2025-02-25 06:45:20 +08:00
H2 better
This commit is contained in:
parent
8e8722bfe3
commit
6014aa587f
8 changed files with 181 additions and 169 deletions
2
pom.xml
2
pom.xml
|
@ -127,7 +127,7 @@
|
|||
<dependency>
|
||||
<groupId>com.github.devezhao</groupId>
|
||||
<artifactId>persist4j</artifactId>
|
||||
<version>246d24811b</version>
|
||||
<version>16caa035e8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
|
|
|
@ -31,6 +31,7 @@ import com.rebuild.server.helper.cache.CommonCache;
|
|||
import com.rebuild.server.helper.cache.EhcacheTemplate;
|
||||
import com.rebuild.server.helper.cache.RecentlyUsedCache;
|
||||
import com.rebuild.server.helper.cache.RecordOwningCache;
|
||||
import com.rebuild.server.helper.setup.Installer;
|
||||
import com.rebuild.server.helper.setup.UpgradeDatabase;
|
||||
import com.rebuild.server.metadata.DynamicMetadataFactory;
|
||||
import com.rebuild.server.service.CommonService;
|
||||
|
@ -178,6 +179,8 @@ public final class Application {
|
|||
if (APPLICATION_CTX == null) {
|
||||
debugMode = true;
|
||||
LOG.info("Rebuild Booting in DEBUG mode ...");
|
||||
Installer.checkInstall();
|
||||
|
||||
long at = System.currentTimeMillis();
|
||||
ApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { "application-ctx.xml" });
|
||||
new Application(ctx).init(at);
|
||||
|
|
|
@ -25,7 +25,6 @@ import cn.devezhao.commons.sql.builder.UpdateBuilder;
|
|||
import cn.devezhao.persist4j.engine.ID;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.mysql.jdbc.Driver;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.ServerListener;
|
||||
import com.rebuild.server.helper.ConfigurableItem;
|
||||
import com.rebuild.server.helper.Lisence;
|
||||
|
@ -217,10 +216,8 @@ public class Installer {
|
|||
for (Object L : LS) {
|
||||
String L2 = L.toString().trim();
|
||||
|
||||
boolean H2Unsupports = quickMode
|
||||
&& (L2.startsWith("alter table") || L2.startsWith("add index") || L2.startsWith("add fulltext"));
|
||||
// Ignore comments and line of blank
|
||||
if (StringUtils.isEmpty(L2) || L2.startsWith("--") || H2Unsupports) continue;
|
||||
if (StringUtils.isEmpty(L2) || L2.startsWith("--")) continue;
|
||||
if (L2.startsWith("/*") || L2.endsWith("*/")) {
|
||||
ignoreMode = L2.startsWith("/*");
|
||||
continue;
|
||||
|
@ -301,7 +298,7 @@ public class Installer {
|
|||
* @return
|
||||
*/
|
||||
public static boolean checkInstall() {
|
||||
if (Application.devMode()) return true; // for dev
|
||||
// if (Application.devMode()) return true; // for dev
|
||||
|
||||
File file = SysConfiguration.getFileOfData(INSTALL_FILE);
|
||||
if (file.exists()) {
|
||||
|
@ -315,6 +312,7 @@ public class Installer {
|
|||
for (Map.Entry<Object, Object> e : dbProps.entrySet()) {
|
||||
System.setProperty((String) e.getKey(), (String) e.getValue());
|
||||
if (e.getKey().equals("db.url") && ((String) e.getValue()).contains("jdbc:h2:")) {
|
||||
LOG.warn("Using QuickMode with H2 database!");
|
||||
try {
|
||||
Class.forName(org.h2.Driver.class.getName());
|
||||
} catch (ClassNotFoundException h2ex) {
|
||||
|
|
|
@ -27,6 +27,7 @@ import cn.devezhao.persist4j.engine.ID;
|
|||
import cn.devezhao.persist4j.metadata.CascadeModel;
|
||||
import cn.devezhao.persist4j.util.support.Table;
|
||||
import com.rebuild.server.Application;
|
||||
import com.rebuild.server.helper.AesPreferencesConfigurer;
|
||||
import com.rebuild.server.metadata.EntityHelper;
|
||||
import com.rebuild.server.metadata.MetadataHelper;
|
||||
import com.rebuild.server.service.bizz.UserService;
|
||||
|
@ -35,6 +36,9 @@ import org.apache.commons.lang.math.RandomUtils;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 创建实体
|
||||
*
|
||||
|
@ -258,13 +262,40 @@ public class Entity2Schema extends Field2Schema {
|
|||
private boolean schema2Database(Entity entity) {
|
||||
Dialect dialect = Application.getPersistManagerFactory().getDialect();
|
||||
Table table = new Table(entity, dialect);
|
||||
String ddl[] = table.generateDDL(false, false);
|
||||
String ddls[] = table.generateDDL(false, false);
|
||||
ddls = reformatForH2(ddls);
|
||||
try {
|
||||
Application.getSQLExecutor().executeBatch(ddl);
|
||||
Application.getSQLExecutor().executeBatch(ddls);
|
||||
} catch (Throwable ex) {
|
||||
LOG.error("DDL Error : \n" + StringUtils.join(ddl, "\n"), ex);
|
||||
LOG.error("DDL Error : \n" + StringUtils.join(ddls, "\n"), ex);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去除 H2 不支持的语句
|
||||
* @param ddls
|
||||
* @return
|
||||
*/
|
||||
private String[] reformatForH2(String[] ddls) {
|
||||
String dbUrl = Application.getBean(AesPreferencesConfigurer.class).getItem("db.url");
|
||||
if (!dbUrl.contains("jdbc:h2:")) return ddls;
|
||||
|
||||
for (int i = 0; i < ddls.length; i++) {
|
||||
List<String> ddl = new ArrayList<>();
|
||||
for (String L2 : ddls[i].split("\n")) {
|
||||
L2 = L2.trim();
|
||||
if (L2.startsWith("index") || L2.startsWith("fulltext") || L2.startsWith("unique")) {
|
||||
continue;
|
||||
}
|
||||
if (L2.startsWith("primary") && L2.endsWith(",")) {
|
||||
L2 = L2.substring(0, L2.length() - 1);
|
||||
}
|
||||
ddl.add(L2);
|
||||
}
|
||||
ddls[i] = StringUtils.join(ddl, "\n");
|
||||
}
|
||||
return ddls;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -57,18 +57,23 @@ public class MetaEntityService extends BaseService implements AdminGuard {
|
|||
// 删除此实体的相关配置记录
|
||||
String whoUsed[] = new String[] {
|
||||
"MetaField", "PickList", "LayoutConfig", "FilterConfig", "ShareAccess", "ChartConfig",
|
||||
"Attachment", "AutoFillinConfig", "RobotTriggerConfig", "RobotApprovalConfig"
|
||||
"Attachment", "AutoFillinConfig", "RobotTriggerConfig", "RobotApprovalConfig",
|
||||
"DataReportConfig",
|
||||
};
|
||||
int del = 0;
|
||||
for (String who : whoUsed) {
|
||||
Entity whoEntity = MetadataHelper.getEntity(who);
|
||||
if (!whoEntity.containsField("belongEntity")) {
|
||||
Entity whichEntity = MetadataHelper.getEntity(who);
|
||||
if (!whichEntity.containsField("belongEntity")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String sql = String.format("select %s from %s where belongEntity = '%s'",
|
||||
whoEntity.getPrimaryField().getName(), whoEntity.getName(), entity.getName());
|
||||
Object[][] usedArray = getPMFactory().createQuery(sql).array();
|
||||
|
||||
String ql = String.format("select %s from %s where belongEntity = '%s'",
|
||||
whichEntity.getPrimaryField().getName(), whichEntity.getName(), entity.getName());
|
||||
if (whichEntity.getEntityCode() == EntityHelper.Attachment) {
|
||||
ql = ql.split(" belongEntity ")[0] + " belongEntity = " + whichEntity.getEntityCode();
|
||||
}
|
||||
|
||||
Object[][] usedArray = getPMFactory().createQuery(ql).array();
|
||||
for (Object[] used : usedArray) {
|
||||
if ("MetaField".equalsIgnoreCase(who)) {
|
||||
del += Application.getBean(MetaFieldService.class).delete((ID) used[0]);
|
||||
|
|
|
@ -28,9 +28,9 @@ create table if not exists `user` (
|
|||
`ROLE_ID` char(20) comment '角色',
|
||||
`IS_DISABLED` char(1) default 'F' comment '是否停用',
|
||||
`QUICK_CODE` varchar(70),
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
primary key (`USER_ID`),
|
||||
unique index `UIX1_user` (`LOGIN_NAME`),
|
||||
|
@ -45,10 +45,10 @@ create table if not exists `department` (
|
|||
`PRINCIPAL_ID` char(20) comment '负责人',
|
||||
`IS_DISABLED` char(1) default 'F' comment '是否停用',
|
||||
`QUICK_CODE` varchar(70),
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
primary key (`DEPT_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
||||
|
@ -58,10 +58,10 @@ create table if not exists `role` (
|
|||
`NAME` varchar(100) not null comment '角色名称',
|
||||
`IS_DISABLED` char(1) default 'F' comment '是否停用',
|
||||
`QUICK_CODE` varchar(70),
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`ROLE_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
||||
|
@ -88,13 +88,13 @@ create table if not exists `role_member` (
|
|||
-- ************ Entity [Team] DDL ************
|
||||
create table if not exists `team` (
|
||||
`TEAM_ID` char(20) not null,
|
||||
`NAME` varchar(100) not null comment '组名称',
|
||||
`NAME` varchar(100) not null comment '团队名称',
|
||||
`PRINCIPAL_ID` char(20) comment '负责人',
|
||||
`IS_DISABLED` char(1) default 'F' comment '是否停用',
|
||||
`QUICK_CODE` varchar(70),
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`TEAM_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
@ -119,9 +119,9 @@ create table if not exists `meta_entity` (
|
|||
`ICON` varchar(60),
|
||||
`NAME_FIELD` varchar(100),
|
||||
`MASTER_ENTITY` varchar(100) comment '明细实体的所属主实体',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
primary key (`ENTITY_ID`),
|
||||
unique index `UIX1_meta_entity` (`TYPE_CODE`),
|
||||
|
@ -147,10 +147,10 @@ create table if not exists `meta_field` (
|
|||
`CASCADE` varchar(20),
|
||||
`COMMENTS` varchar(300),
|
||||
`EXT_CONFIG` varchar(700) comment '更多扩展配置, JSON格式KV',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`FIELD_ID`),
|
||||
unique index `UIX1_meta_field` (`BELONG_ENTITY`, `FIELD_NAME`),
|
||||
unique index `UIX2_meta_field` (`BELONG_ENTITY`, `PHYSICAL_NAME`)
|
||||
|
@ -166,14 +166,13 @@ create table if not exists `pick_list` (
|
|||
`IS_DEFAULT` char(1) default 'F',
|
||||
`IS_HIDE` char(1) default 'F',
|
||||
`MASK_VALUE` bigint(20) default '0' comment 'MultiSelect专用',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
primary key (`ITEM_ID`)
|
||||
primary key (`ITEM_ID`),
|
||||
index `IX1_pick_list` (`BELONG_ENTITY`, `BELONG_FIELD`)
|
||||
)Engine=InnoDB;
|
||||
alter table `pick_list`
|
||||
add index `IX1_pick_list` (`BELONG_ENTITY`, `BELONG_FIELD`);
|
||||
|
||||
-- ************ Entity [LayoutConfig] DDL ************
|
||||
create table if not exists `layout_config` (
|
||||
|
@ -183,10 +182,10 @@ create table if not exists `layout_config` (
|
|||
`BELONG_ENTITY` varchar(100) not null,
|
||||
`APPLY_TYPE` varchar(20) not null comment 'FORM,DATALIST,NAV,TBA,ADD',
|
||||
`CONFIG_NAME` varchar(100),
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
primary key (`CONFIG_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
||||
|
@ -197,10 +196,10 @@ create table if not exists `filter_config` (
|
|||
`SHARE_TO` varchar(420) default 'SELF' comment '共享给哪些人, 可选值: ALL/SELF/$MemberID(U/D/R)',
|
||||
`BELONG_ENTITY` varchar(100) not null,
|
||||
`FILTER_NAME` varchar(100) not null,
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`CONFIG_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
||||
|
@ -211,9 +210,9 @@ create table if not exists `dashboard_config` (
|
|||
`SHARE_TO` varchar(420) default 'SELF' comment '共享给哪些人, 可选值: ALL/SELF/$MemberID(U/D/R)',
|
||||
`TITLE` varchar(100) not null,
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`CONFIG_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
||||
|
@ -225,8 +224,8 @@ create table if not exists `chart_config` (
|
|||
`CHART_TYPE` varchar(100) not null,
|
||||
`TITLE` varchar(100) not null,
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`CHART_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
@ -239,9 +238,9 @@ create table if not exists `classification` (
|
|||
`IS_DISABLED` char(1) default 'F',
|
||||
`OPEN_LEVEL` smallint(6) default '0',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
primary key (`DATA_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
||||
|
@ -256,14 +255,13 @@ create table if not exists `classification_data` (
|
|||
`LEVEL` smallint(6) default '0',
|
||||
`IS_HIDE` char(1) default 'F',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`ITEM_ID`)
|
||||
primary key (`ITEM_ID`),
|
||||
index `IX1_classification_data` (`DATA_ID`, `PARENT`),
|
||||
index `IX2_classification_data` (`DATA_ID`, `FULL_NAME`)
|
||||
)Engine=InnoDB;
|
||||
alter table `classification_data`
|
||||
add index `IX1_classification_data` (`DATA_ID`, `PARENT`),
|
||||
add index `IX2_classification_data` (`DATA_ID`, `FULL_NAME`);
|
||||
|
||||
-- ************ Entity [ShareAccess] DDL ************
|
||||
create table if not exists `share_access` (
|
||||
|
@ -272,14 +270,13 @@ create table if not exists `share_access` (
|
|||
`RECORD_ID` char(20) not null comment '记录ID',
|
||||
`SHARE_TO` char(20) not null comment '共享给谁(U/D/R)',
|
||||
`RIGHTS` int(11) not null default '0' comment '共享权限(R=2,U=4,D=8,0=Auto)',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`ACCESS_ID`)
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
primary key (`ACCESS_ID`),
|
||||
index `IX1_share_access` (`BELONG_ENTITY`, `RECORD_ID`, `SHARE_TO`)
|
||||
)Engine=InnoDB;
|
||||
alter table `share_access`
|
||||
add index `IX1_share_access` (`BELONG_ENTITY`, `RECORD_ID`, `SHARE_TO`);
|
||||
|
||||
-- ************ Entity [SystemConfig] DDL ************
|
||||
create table if not exists `system_config` (
|
||||
|
@ -300,14 +297,13 @@ create table if not exists `notification` (
|
|||
`TYPE` smallint(6) default '0' comment '消息分类',
|
||||
`RELATED_RECORD` char(20) comment '相关业务记录',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
primary key (`MESSAGE_ID`)
|
||||
primary key (`MESSAGE_ID`),
|
||||
index `IX1_notification` (`TO_USER`, `UNREAD`, `CREATED_ON`),
|
||||
index `IX2_notification` (`TO_USER`, `TYPE`, `CREATED_ON`)
|
||||
)Engine=InnoDB;
|
||||
alter table `notification`
|
||||
add index `IX1_notification` (`TO_USER`, `UNREAD`, `CREATED_ON`),
|
||||
add index `IX2_notification` (`TO_USER`, `TYPE`, `CREATED_ON`);
|
||||
|
||||
-- ************ Entity [Attachment] DDL ************
|
||||
create table if not exists `attachment` (
|
||||
|
@ -319,16 +315,15 @@ create table if not exists `attachment` (
|
|||
`FILE_TYPE` varchar(20),
|
||||
`FILE_SIZE` int(11) default '0' comment 'in bytes',
|
||||
`IN_FOLDER` char(20),
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`ATTACHMENT_ID`)
|
||||
primary key (`ATTACHMENT_ID`),
|
||||
index `IX1_attachment` (`BELONG_ENTITY`, `BELONG_FIELD`, `FILE_PATH`),
|
||||
index `IX2_attachment` (`RELATED_RECORD`),
|
||||
index `IX3_attachment` (`IN_FOLDER`, `CREATED_ON`)
|
||||
)Engine=InnoDB;
|
||||
alter table `attachment`
|
||||
add index `IX1_attachment` (`BELONG_ENTITY`, `BELONG_FIELD`, `FILE_PATH`),
|
||||
add index `IX2_attachment` (`RELATED_RECORD`),
|
||||
add index `IX3_attachment` (`IN_FOLDER`, `CREATED_ON`);
|
||||
|
||||
-- ************ Entity [AttachmentFolder] DDL ************
|
||||
create table if not exists `attachment_folder` (
|
||||
|
@ -336,14 +331,13 @@ create table if not exists `attachment_folder` (
|
|||
`NAME` varchar(100) not null,
|
||||
`PARENT` char(20),
|
||||
`SCOPE` varchar(20) default 'ALL' comment '哪些人可见, 可选值: ALL/SELF/$TeamID',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`FOLDER_ID`)
|
||||
primary key (`FOLDER_ID`),
|
||||
index `IX1_attachment_folder` (`SCOPE`, `CREATED_BY`)
|
||||
)Engine=InnoDB;
|
||||
alter table `attachment_folder`
|
||||
add index `IX1_attachment_folder` (`SCOPE`, `CREATED_BY`);
|
||||
|
||||
-- ************ Entity [LoginLog] DDL ************
|
||||
create table if not exists `login_log` (
|
||||
|
@ -353,10 +347,9 @@ create table if not exists `login_log` (
|
|||
`USER_AGENT` varchar(200) comment '客户端',
|
||||
`LOGIN_TIME` timestamp not null default current_timestamp comment '登陆时间',
|
||||
`LOGOUT_TIME` timestamp null default null comment '退出时间',
|
||||
primary key (`LOG_ID`)
|
||||
primary key (`LOG_ID`),
|
||||
index `IX1_login_log` (`USER`, `LOGIN_TIME`)
|
||||
)Engine=InnoDB;
|
||||
alter table `login_log`
|
||||
add index `IX1_login_log` (`USER`, `LOGIN_TIME`);
|
||||
|
||||
-- ************ Entity [AutoFillinConfig] DDL ************
|
||||
create table if not exists `auto_fillin_config` (
|
||||
|
@ -366,10 +359,10 @@ create table if not exists `auto_fillin_config` (
|
|||
`SOURCE_FIELD` varchar(100) not null comment '引用实体的字段',
|
||||
`TARGET_FIELD` varchar(100) not null comment '当前实体的字段',
|
||||
`EXT_CONFIG` varchar(700) comment '更多扩展配置, JSON格式KV',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
primary key (`CONFIG_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
||||
|
@ -384,10 +377,10 @@ create table if not exists `robot_trigger_config` (
|
|||
`PRIORITY` int(11) default '1' comment '执行优先级, 越大越高(越先执行)',
|
||||
`NAME` varchar(100) comment '触发器名称',
|
||||
`IS_DISABLED` char(1) default 'F' comment '是否停用',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`CONFIG_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
||||
|
@ -398,9 +391,9 @@ create table if not exists `robot_approval_config` (
|
|||
`NAME` varchar(100) not null comment '流程名称',
|
||||
`FLOW_DEFINITION` text(21845) comment '流程定义',
|
||||
`IS_DISABLED` char(1) default 'F' comment '是否停用',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`CONFIG_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
@ -420,12 +413,11 @@ create table if not exists `robot_approval_step` (
|
|||
`IS_WAITING` char(1) default 'F' comment '是否生效',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`STEP_ID`)
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
primary key (`STEP_ID`),
|
||||
index `IX1_robot_approval_step` (`RECORD_ID`, `APPROVAL_ID`, `NODE`, `IS_CANCELED`, `IS_WAITING`)
|
||||
)Engine=InnoDB;
|
||||
alter table `robot_approval_step`
|
||||
add index `IX1_robot_approval_step` (`RECORD_ID`, `APPROVAL_ID`, `NODE`, `IS_CANCELED`, `IS_WAITING`);
|
||||
|
||||
-- ************ Entity [RebuildApi] DDL ************
|
||||
create table if not exists `rebuild_api` (
|
||||
|
@ -435,9 +427,9 @@ create table if not exists `rebuild_api` (
|
|||
`BIND_USER` char(20) comment '绑定用户(权限)',
|
||||
`BIND_IPS` varchar(300) comment 'IP白名单',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`UNIQUE_ID`),
|
||||
unique index `UIX1_rebuild_api` (`APP_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
@ -452,10 +444,9 @@ create table if not exists `rebuild_api_request` (
|
|||
`RESPONSE_BODY` text(10000) not null comment '响应数据',
|
||||
`REQUEST_TIME` timestamp not null default current_timestamp comment '请求时间',
|
||||
`RESPONSE_TIME` timestamp not null default current_timestamp comment '响应时间',
|
||||
primary key (`REQUEST_ID`)
|
||||
primary key (`REQUEST_ID`),
|
||||
index `IX1_rebuild_api_request` (`APP_ID`, `REMOTE_IP`, `REQUEST_URL`, `REQUEST_TIME`)
|
||||
)Engine=InnoDB;
|
||||
alter table `rebuild_api_request`
|
||||
add index `IX1_rebuild_api_request` (`APP_ID`, `REMOTE_IP`, `REQUEST_URL`, `REQUEST_TIME`);
|
||||
|
||||
-- ************ Entity [DataReportConfig] DDL ************
|
||||
create table if not exists `data_report_config` (
|
||||
|
@ -465,9 +456,9 @@ create table if not exists `data_report_config` (
|
|||
`TEMPLATE_FILE` varchar(200) comment '模板文件',
|
||||
`TEMPLATE_CONTENT` text(20000) comment '模板内容',
|
||||
`IS_DISABLED` char(1) default 'F' comment '是否停用',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`CONFIG_ID`)
|
||||
)Engine=InnoDB;
|
||||
|
@ -482,11 +473,10 @@ create table if not exists `recycle_bin` (
|
|||
`DELETED_BY` char(20) not null comment '删除人',
|
||||
`DELETED_ON` timestamp not null default current_timestamp comment '删除时间',
|
||||
`CHANNEL_WITH` char(20) comment '删除渠道(空为直接删除,否则为关联删除)',
|
||||
primary key (`RECYCLE_ID`)
|
||||
primary key (`RECYCLE_ID`),
|
||||
index `IX1_recycle_bin` (`BELONG_ENTITY`, `RECORD_NAME`, `DELETED_BY`, `DELETED_ON`),
|
||||
index `IX2_recycle_bin` (`RECORD_ID`, `CHANNEL_WITH`)
|
||||
)Engine=InnoDB;
|
||||
alter table `recycle_bin`
|
||||
add index `IX1_recycle_bin` (`BELONG_ENTITY`, `RECORD_NAME`, `DELETED_BY`, `DELETED_ON`),
|
||||
add index `IX2_recycle_bin` (`RECORD_ID`, `CHANNEL_WITH`);
|
||||
|
||||
-- ************ Entity [RevisionHistory] DDL ************
|
||||
create table if not exists `revision_history` (
|
||||
|
@ -498,11 +488,10 @@ create table if not exists `revision_history` (
|
|||
`REVISION_BY` char(20) not null comment '操作人',
|
||||
`REVISION_ON` timestamp not null default current_timestamp comment '操作时间',
|
||||
`CHANNEL_WITH` char(20) comment '变更渠道(空为直接,否则为关联)',
|
||||
primary key (`REVISION_ID`)
|
||||
primary key (`REVISION_ID`),
|
||||
index `IX1_revision_history` (`BELONG_ENTITY`, `REVISION_TYPE`, `REVISION_BY`, `REVISION_ON`),
|
||||
index `IX2_revision_history` (`RECORD_ID`, `CHANNEL_WITH`)
|
||||
)Engine=InnoDB;
|
||||
alter table `revision_history`
|
||||
add index `IX1_revision_history` (`BELONG_ENTITY`, `REVISION_TYPE`, `REVISION_BY`, `REVISION_ON`),
|
||||
add index `IX2_revision_history` (`RECORD_ID`, `CHANNEL_WITH`);
|
||||
|
||||
-- ************ Entity [Feeds] DDL ************
|
||||
create table if not exists `feeds` (
|
||||
|
@ -513,16 +502,15 @@ create table if not exists `feeds` (
|
|||
`ATTACHMENTS` varchar(700) comment '附件',
|
||||
`RELATED_RECORD` char(20) comment '相关业务记录',
|
||||
`SCOPE` varchar(20) default 'ALL' comment '哪些人可见, 可选值: ALL/SELF/$TeamID',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`FEEDS_ID`)
|
||||
primary key (`FEEDS_ID`),
|
||||
index `IX1_feeds` (`CREATED_ON`, `SCOPE`, `TYPE`, `CREATED_BY`),
|
||||
index `IX2_feeds` (`RELATED_RECORD`),
|
||||
fulltext index `FIX3_feeds` (`CONTENT`)
|
||||
)Engine=InnoDB;
|
||||
alter table `feeds`
|
||||
add index `IX1_feeds` (`CREATED_ON`, `SCOPE`, `TYPE`, `CREATED_BY`),
|
||||
add index `IX2_feeds` (`RELATED_RECORD`),
|
||||
add fulltext index `FIX3_feeds` (`CONTENT`);
|
||||
|
||||
-- ************ Entity [FeedsComment] DDL ************
|
||||
create table if not exists `feeds_comment` (
|
||||
|
@ -531,14 +519,13 @@ create table if not exists `feeds_comment` (
|
|||
`CONTENT` text(3000) not null comment '内容',
|
||||
`IMAGES` varchar(700) comment '图片',
|
||||
`ATTACHMENTS` varchar(700) comment '附件',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
primary key (`COMMENT_ID`)
|
||||
primary key (`COMMENT_ID`),
|
||||
index `IX1_feeds_comment` (`FEEDS_ID`)
|
||||
)Engine=InnoDB;
|
||||
alter table `feeds_comment`
|
||||
add index `IX1_feeds_comment` (`FEEDS_ID`);
|
||||
|
||||
-- ************ Entity [FeedsLike] DDL ************
|
||||
create table if not exists `feeds_like` (
|
||||
|
@ -546,10 +533,9 @@ create table if not exists `feeds_like` (
|
|||
`SOURCE` char(20) not null comment '哪个动态/评论',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
primary key (`LIKE_ID`)
|
||||
primary key (`LIKE_ID`),
|
||||
index `IX1_feeds_like` (`SOURCE`, `CREATED_BY`)
|
||||
)Engine=InnoDB;
|
||||
alter table `feeds_like`
|
||||
add index `IX1_feeds_like` (`SOURCE`, `CREATED_BY`);
|
||||
|
||||
-- ************ Entity [FeedsMention] DDL ************
|
||||
create table if not exists `feeds_mention` (
|
||||
|
@ -557,10 +543,9 @@ create table if not exists `feeds_mention` (
|
|||
`FEEDS_ID` char(20) not null comment '哪个动态',
|
||||
`COMMENT_ID` char(20) comment '哪个评论',
|
||||
`USER` char(20) not null comment '哪个用户',
|
||||
primary key (`MENTION_ID`)
|
||||
primary key (`MENTION_ID`),
|
||||
index `IX1_feeds_mention` (`USER`, `FEEDS_ID`, `COMMENT_ID`)
|
||||
)Engine=InnoDB;
|
||||
alter table `feeds_mention`
|
||||
add index `IX1_feeds_mention` (`USER`, `FEEDS_ID`, `COMMENT_ID`);
|
||||
|
||||
|
||||
-- #3 datas
|
||||
|
@ -603,4 +588,4 @@ INSERT INTO `classification` (`DATA_ID`, `NAME`, `DESCRIPTION`, `OPEN_LEVEL`, `I
|
|||
|
||||
-- DB Version
|
||||
INSERT INTO `system_config` (`CONFIG_ID`, `ITEM`, `VALUE`)
|
||||
VALUES ('021-0000000000000001', 'DBVer', 18);
|
||||
VALUES ('021-9000000000000001', 'DBVer', 18);
|
||||
|
|
|
@ -14,10 +14,10 @@ create table if not exists `team` (
|
|||
`PRINCIPAL_ID` char(20) comment '负责人',
|
||||
`IS_DISABLED` char(1) default 'F' comment '是否停用',
|
||||
`QUICK_CODE` varchar(70),
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`TEAM_ID`)
|
||||
)Engine=InnoDB;
|
||||
-- ************ Entity [TeamMember] DDL ************
|
||||
|
@ -33,7 +33,7 @@ INSERT INTO `team` (`TEAM_ID`, `NAME`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`
|
|||
('006-9000000000000001', 'RB示例团队', CURRENT_TIMESTAMP, '001-0000000000000000', CURRENT_TIMESTAMP, '001-0000000000000000', 'RBSLTD');
|
||||
INSERT INTO `layout_config` (`CONFIG_ID`, `BELONG_ENTITY`, `CONFIG`, `APPLY_TYPE`, `SHARE_TO`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`)
|
||||
VALUES
|
||||
(CONCAT('013-',SUBSTRING(MD5(RAND()),1,16)), 'Team', '[{"field":"name","isFull":false},{"field":"isDisabled","isFull":false}]', 'FORM', 'ALL', CURRENT_TIMESTAMP, '001-0000000000000001', CURRENT_TIMESTAMP, '001-0000000000000001');
|
||||
('013-9000000000000004', 'Team', '[{"field":"name","isFull":false},{"field":"isDisabled","isFull":false}]', 'FORM', 'ALL', CURRENT_TIMESTAMP, '001-0000000000000001', CURRENT_TIMESTAMP, '001-0000000000000001');
|
||||
|
||||
-- Principal
|
||||
alter table `department`
|
||||
|
@ -49,16 +49,15 @@ create table if not exists `feeds` (
|
|||
`ATTACHMENTS` varchar(700) comment '附件',
|
||||
`RELATED_RECORD` char(20) comment '相关业务记录',
|
||||
`SCOPE` varchar(20) default 'ALL' comment '哪些人可见, 可选值: ALL/SELF/$TeamID',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
primary key (`FEEDS_ID`)
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`FEEDS_ID`),
|
||||
index `IX1_feeds` (`CREATED_ON`, `SCOPE`, `TYPE`, `CREATED_BY`),
|
||||
index `IX2_feeds` (`RELATED_RECORD`),
|
||||
fulltext index `FIX3_feeds` (`CONTENT`)
|
||||
)Engine=InnoDB;
|
||||
alter table `feeds`
|
||||
add index `IX1_feeds` (`CREATED_ON`, `SCOPE`, `TYPE`, `CREATED_BY`),
|
||||
add index `IX2_feeds` (`RELATED_RECORD`),
|
||||
add fulltext index `FIX3_feeds` (`CONTENT`);
|
||||
-- ************ Entity [FeedsComment] DDL ************
|
||||
create table if not exists `feeds_comment` (
|
||||
`COMMENT_ID` char(20) not null,
|
||||
|
@ -66,41 +65,38 @@ create table if not exists `feeds_comment` (
|
|||
`CONTENT` text(3000) not null comment '内容',
|
||||
`IMAGES` varchar(700) comment '图片',
|
||||
`ATTACHMENTS` varchar(700) comment '附件',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
primary key (`COMMENT_ID`)
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`COMMENT_ID`),
|
||||
index `IX1_feeds_comment` (`FEEDS_ID`)
|
||||
)Engine=InnoDB;
|
||||
alter table `feeds_comment`
|
||||
add index `IX1_feeds_comment` (`FEEDS_ID`);
|
||||
-- ************ Entity [FeedsLike] DDL ************
|
||||
create table if not exists `feeds_like` (
|
||||
`LIKE_ID` char(20) not null,
|
||||
`SOURCE` char(20) not null comment '哪个动态/评论',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
primary key (`LIKE_ID`)
|
||||
primary key (`LIKE_ID`),
|
||||
index `IX1_feeds_like` (`SOURCE`, `CREATED_BY`)
|
||||
)Engine=InnoDB;
|
||||
alter table `feeds_like`
|
||||
add index `IX1_feeds_like` (`SOURCE`, `CREATED_BY`);
|
||||
-- ************ Entity [FeedsMention] DDL ************
|
||||
create table if not exists `feeds_mention` (
|
||||
`MENTION_ID` char(20) not null,
|
||||
`FEEDS_ID` char(20) not null comment '哪个动态',
|
||||
`COMMENT_ID` char(20) comment '哪个评论',
|
||||
`USER` char(20) not null comment '哪个用户',
|
||||
primary key (`MENTION_ID`)
|
||||
primary key (`MENTION_ID`),
|
||||
index `IX1_feeds_mention` (`USER`, `FEEDS_ID`, `COMMENT_ID`)
|
||||
)Engine=InnoDB;
|
||||
alter table `feeds_mention`
|
||||
add index `IX1_feeds_mention` (`USER`, `FEEDS_ID`, `COMMENT_ID`);
|
||||
|
||||
-- #15 Widget in page (v1.6)
|
||||
-- UNDO
|
||||
|
||||
-- #14 Name for LayoutConfig (v1.6)
|
||||
alter table `layout_config`
|
||||
add column `CONFIG_NAME` varchar(100);
|
||||
add column `CONFIG_NAME` varchar(100);
|
||||
|
||||
-- #13 MultiSelect supports by PickList (v1.6)
|
||||
alter table `pick_list`
|
||||
|
@ -109,7 +105,7 @@ alter table `pick_list`
|
|||
|
||||
-- #12 Field can be repeated (v1.5)
|
||||
alter table `meta_field`
|
||||
add column `REPEATABLE` char(1) default 'T';
|
||||
add column `REPEATABLE` char(1) default 'T';
|
||||
|
||||
-- #11 Audit (v1.5)
|
||||
-- ************ Entity [RecycleBin] DDL ************
|
||||
|
@ -121,12 +117,11 @@ create table if not exists `recycle_bin` (
|
|||
`RECORD_CONTENT` longtext not null comment '数据',
|
||||
`DELETED_BY` char(20) not null comment '删除人',
|
||||
`DELETED_ON` timestamp not null default current_timestamp comment '删除时间',
|
||||
`CHANNEL_WITH` char(20) comment '删除渠道(空为直接删除,否则为关联删除)',
|
||||
primary key (`RECYCLE_ID`)
|
||||
`CHANNEL_WITH` char(20) comment '删除渠道(空为直接删除,否则为关联删除)',
|
||||
primary key (`RECYCLE_ID`),
|
||||
index `IX1_recycle_bin` (`BELONG_ENTITY`, `RECORD_NAME`, `DELETED_BY`, `DELETED_ON`),
|
||||
index `IX2_recycle_bin` (`RECORD_ID`, `CHANNEL_WITH`)
|
||||
)Engine=InnoDB;
|
||||
alter table `recycle_bin`
|
||||
add index `IX1_recycle_bin` (`BELONG_ENTITY`, `RECORD_NAME`, `DELETED_BY`, `DELETED_ON`),
|
||||
add index `IX2_recycle_bin` (`RECORD_ID`, `CHANNEL_WITH`);
|
||||
-- ************ Entity [RevisionHistory] DDL ************
|
||||
create table if not exists `revision_history` (
|
||||
`REVISION_ID` char(20) not null,
|
||||
|
@ -136,12 +131,11 @@ create table if not exists `revision_history` (
|
|||
`REVISION_CONTENT` longtext not null comment '变更数据',
|
||||
`REVISION_BY` char(20) not null comment '操作人',
|
||||
`REVISION_ON` timestamp not null default current_timestamp comment '操作时间',
|
||||
`CHANNEL_WITH` char(20) comment '变更渠道(空为直接,否则为关联)',
|
||||
primary key (`REVISION_ID`)
|
||||
`CHANNEL_WITH` char(20) comment '变更渠道(空为直接,否则为关联)',
|
||||
primary key (`REVISION_ID`),
|
||||
index `IX1_revision_history` (`BELONG_ENTITY`, `REVISION_TYPE`, `REVISION_BY`, `REVISION_ON`),
|
||||
index `IX2_revision_history` (`RECORD_ID`, `CHANNEL_WITH`)
|
||||
)Engine=InnoDB;
|
||||
alter table `revision_history`
|
||||
add index `IX1_revision_history` (`BELONG_ENTITY`, `REVISION_TYPE`, `REVISION_BY`, `REVISION_ON`),
|
||||
add index `IX2_revision_history` (`RECORD_ID`, `CHANNEL_WITH`);
|
||||
|
||||
-- #10 Reports (v1.5)
|
||||
-- ************ Entity [DataReportConfig] DDL ************
|
||||
|
@ -161,8 +155,8 @@ create table if not exists `data_report_config` (
|
|||
|
||||
-- #9 Add name and isDisabled to RobotTriggerConfig (v1.4)
|
||||
alter table `robot_trigger_config`
|
||||
add column `NAME` varchar(100) comment '触发器名称',
|
||||
add column `IS_DISABLED` char(1) default 'F' comment '是否停用';
|
||||
add column `NAME` varchar(100) comment '触发器名称',
|
||||
add column `IS_DISABLED` char(1) default 'F' comment '是否停用';
|
||||
|
||||
-- #8 API (v1.4)
|
||||
-- ************ Entity [RebuildApi] DDL ************
|
||||
|
@ -189,10 +183,9 @@ create table if not exists `rebuild_api_request` (
|
|||
`RESPONSE_BODY` text(10000) not null comment '响应数据',
|
||||
`REQUEST_TIME` timestamp not null default current_timestamp comment '请求时间',
|
||||
`RESPONSE_TIME` timestamp not null default current_timestamp comment '响应时间',
|
||||
primary key (`REQUEST_ID`)
|
||||
primary key (`REQUEST_ID`),
|
||||
index `IX1_rebuild_api_request` (`APP_ID`, `REMOTE_IP`, `REQUEST_URL`, `REQUEST_TIME`)
|
||||
)Engine=InnoDB;
|
||||
alter table `rebuild_api_request`
|
||||
add index `IX1_rebuild_api_request` (`APP_ID`, `REMOTE_IP`, `REQUEST_URL`, `REQUEST_TIME`);
|
||||
|
||||
-- #7 Type of Notification
|
||||
alter table `notification`
|
||||
|
@ -207,10 +200,10 @@ create table if not exists `robot_approval_config` (
|
|||
`NAME` varchar(100) not null comment '流程名称',
|
||||
`FLOW_DEFINITION` text(21845) comment '流程定义',
|
||||
`IS_DISABLED` char(1) default 'F' comment '是否停用',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`CONFIG_ID`)
|
||||
)Engine=InnoDB;
|
||||
-- ************ Entity [RobotApprovalStep] DDL ************
|
||||
|
@ -227,13 +220,12 @@ create table if not exists `robot_approval_step` (
|
|||
`IS_CANCELED` char(1) default 'F' comment '是否取消',
|
||||
`IS_WAITING` char(1) default 'F' comment '是否生效',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
primary key (`STEP_ID`)
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
primary key (`STEP_ID`),
|
||||
index `IX1_robot_approval_step` (`RECORD_ID`, `APPROVAL_ID`, `NODE`, `IS_CANCELED`, `IS_WAITING`)
|
||||
)Engine=InnoDB;
|
||||
alter table `robot_approval_step`
|
||||
add index `IX1_robot_approval_step` (`RECORD_ID`, `APPROVAL_ID`, `NODE`, `IS_CANCELED`, `IS_WAITING`);
|
||||
|
||||
-- #5 Classification better (v1.3)
|
||||
alter table `classification_data`
|
||||
|
@ -289,10 +281,10 @@ create table if not exists `classification` (
|
|||
`DESCRIPTION` varchar(600),
|
||||
`IS_DISABLED` char(1) default 'F',
|
||||
`OPEN_LEVEL` smallint(6) default '0',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
primary key (`DATA_ID`)
|
||||
)Engine=InnoDB;
|
||||
-- ************ Entity [ClassificationData] DDL ************
|
||||
|
@ -305,15 +297,14 @@ create table if not exists `classification_data` (
|
|||
`CODE` varchar(50),
|
||||
`LEVEL` smallint(6) default '0',
|
||||
`IS_HIDE` char(1) default 'F',
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
`CREATED_BY` char(20) not null comment '创建人',
|
||||
`MODIFIED_BY` char(20) not null comment '修改人',
|
||||
`MODIFIED_ON` timestamp not null default current_timestamp comment '修改时间',
|
||||
primary key (`ITEM_ID`)
|
||||
`CREATED_ON` timestamp not null default current_timestamp comment '创建时间',
|
||||
primary key (`ITEM_ID`),
|
||||
index `IX1_classification_data` (`DATA_ID`, `PARENT`),
|
||||
index `IX2_classification_data` (`DATA_ID`, `FULL_NAME`)
|
||||
)Engine=InnoDB;
|
||||
alter table `classification_data`
|
||||
add index `IX1_classification_data` (`DATA_ID`, `PARENT`),
|
||||
add index `IX2_classification_data` (`DATA_ID`, `FULL_NAME`);
|
||||
INSERT INTO `classification` (`DATA_ID`, `NAME`, `DESCRIPTION`, `OPEN_LEVEL`, `IS_DISABLED`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`)
|
||||
VALUES
|
||||
('018-0000000000000001', '地区', NULL, 2, 'F', CURRENT_TIMESTAMP, '001-0000000000000001', CURRENT_TIMESTAMP, '001-0000000000000001'),
|
||||
|
@ -325,12 +316,11 @@ create table if not exists `login_log` (
|
|||
`LOG_ID` char(20) not null,
|
||||
`USER` char(20) not null comment '登陆用户',
|
||||
`IP_ADDR` varchar(100) comment 'IP地址',
|
||||
`USER_AGENT` varchar(100) comment '客户端',
|
||||
`USER_AGENT` varchar(200) comment '客户端',
|
||||
`LOGIN_TIME` timestamp not null default current_timestamp comment '登陆时间',
|
||||
`LOGOUT_TIME` timestamp null default null comment '退出时间',
|
||||
primary key (`LOG_ID`)
|
||||
primary key (`LOG_ID`),
|
||||
index `IX1_login_log` (`USER`, `LOGIN_TIME`)
|
||||
)Engine=InnoDB;
|
||||
alter table `login_log`
|
||||
add index `IX1_login_log` (`USER`, `LOGIN_TIME`);
|
||||
INSERT INTO `layout_config` (`CONFIG_ID`, `BELONG_ENTITY`, `CONFIG`, `APPLY_TYPE`, `SHARE_TO`, `CREATED_ON`, `CREATED_BY`, `MODIFIED_ON`, `MODIFIED_BY`)
|
||||
VALUES (CONCAT('013-',SUBSTRING(MD5(RAND()),1,16)), 'LoginLog', '[{"field":"user"},{"field":"loginTime"},{"field":"userAgent"},{"field":"ipAddr"},{"field":"logoutTime"}]', 'DATALIST', 'ALL', CURRENT_TIMESTAMP, '001-0000000000000001', CURRENT_TIMESTAMP, '001-0000000000000001');
|
||||
VALUES ('013-9000000000000005', 'LoginLog', '[{"field":"user"},{"field":"loginTime"},{"field":"userAgent"},{"field":"ipAddr"},{"field":"logoutTime"}]', 'DATALIST', 'ALL', CURRENT_TIMESTAMP, '001-0000000000000001', CURRENT_TIMESTAMP, '001-0000000000000001');
|
|
@ -35,7 +35,7 @@ public class InstallerTest {
|
|||
|
||||
@Test
|
||||
public void getDbInitScript() throws Exception {
|
||||
String[] scripts = new Installer(null).getDbInitScript();
|
||||
String[] scripts = new Installer(USE_H2).getDbInitScript();
|
||||
for (String s : scripts) {
|
||||
System.out.println(s);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue