diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/audit/OperatorUtils.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/audit/OperatorUtils.java index e8b6b1254c..a0233c7e93 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/audit/OperatorUtils.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/audit/OperatorUtils.java @@ -65,7 +65,7 @@ public class OperatorUtils { auditLog.setModelType(auditType.getAuditModelType().getName()); auditLog.setOperationType(auditType.getAuditOperationType().getName()); auditLog.setDescription(apiDescription); - auditLog.setTime(new Date()); + auditLog.setCreateTime(new Date()); auditLogList.add(auditLog); return auditLogList; diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/AuditDto.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/AuditDto.java index 2c4144220b..0b36325b44 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/AuditDto.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/dto/AuditDto.java @@ -34,7 +34,7 @@ public class AuditDto { private String operation; - private Date time; + private Date createTime; private String description; diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AuditServiceImpl.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AuditServiceImpl.java index bdc7a4c573..2ec547bcb6 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AuditServiceImpl.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/impl/AuditServiceImpl.java @@ -129,7 +129,7 @@ public class AuditServiceImpl extends BaseServiceImpl implements AuditService { auditDto.setLatency(String.valueOf(auditLog.getLatency())); auditDto.setDetail(auditLog.getDetail()); auditDto.setDescription(auditLog.getDescription()); - auditDto.setTime(auditLog.getTime()); + auditDto.setCreateTime(auditLog.getCreateTime()); return auditDto; } } diff --git a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/AuditLog.java b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/AuditLog.java index 397fa722e5..7c6f76e1da 100644 --- a/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/AuditLog.java +++ b/dolphinscheduler-dao/src/main/java/org/apache/dolphinscheduler/dao/entity/AuditLog.java @@ -67,7 +67,7 @@ public class AuditLog { /** * operation time */ - private Date time; + private Date createTime; private String detail; diff --git a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AuditLogMapper.xml b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AuditLogMapper.xml index 94430a343a..63adb57c34 100644 --- a/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AuditLogMapper.xml +++ b/dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/AuditLogMapper.xml @@ -19,10 +19,10 @@ - id, user_id, model_type, operation_type, model_id, model_name, time, detail, description, latency + id, user_id, model_type, operation_type, model_id, model_name, create_time, detail, description, latency - ${alias}.id, ${alias}.user_id, ${alias}.model_type, ${alias}.operation_type, ${alias}.model_id, ${alias}.model_name, ${alias}.time, ${alias}.detail, ${alias}.description, ${alias}.latency + ${alias}.id, ${alias}.user_id, ${alias}.model_type, ${alias}.operation_type, ${alias}.model_id, ${alias}.model_name, ${alias}.create_time, ${alias}.detail, ${alias}.description, ${alias}.latency diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql index 4187b93a1c..42c893bb05 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_h2.sql @@ -2027,7 +2027,7 @@ CREATE TABLE t_ds_audit_log description varchar(255) NOT NULL, latency int(11) NOT NULL, detail varchar(255) DEFAULT NULL, - time timestamp NULL DEFAULT CURRENT_TIMESTAMP, + create_time timestamp NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY (id) ); diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql index f3d01c14b5..e2138b67a2 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_mysql.sql @@ -2016,7 +2016,7 @@ CREATE TABLE `t_ds_audit_log` ( `description` varchar(100) DEFAULT NULL COMMENT 'api description', `latency` int(11) DEFAULT NULL COMMENT 'api cost milliseconds', `detail` varchar(100) DEFAULT NULL COMMENT 'object change detail', - `time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'operation time', + `create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'operation time', PRIMARY KEY (`id`) ) ENGINE=InnoDB AUTO_INCREMENT= 1 DEFAULT CHARSET=utf8 COLLATE = utf8_bin; diff --git a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql index 5dd804c0c7..2d224092c4 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/dolphinscheduler_postgresql.sql @@ -2001,7 +2001,7 @@ CREATE TABLE t_ds_audit_log ( description VARCHAR(255) NOT NULL, latency int NOT NULL, detail VARCHAR(255) DEFAULT NULL, - time timestamp DEFAULT NULL , + create_time timestamp DEFAULT NULL , PRIMARY KEY (id) ); diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/mysql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/mysql/dolphinscheduler_ddl.sql index b5e5b31d11..d10ac6b710 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/mysql/dolphinscheduler_ddl.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/mysql/dolphinscheduler_ddl.sql @@ -47,7 +47,7 @@ drop resource_type, drop operation, drop resource_id, add `description` varchar(100) DEFAULT NULL COMMENT 'api description', add `latency` int(11) DEFAULT NULL COMMENT 'api cost milliseconds', add `detail` varchar(100) DEFAULT NULL COMMENT 'object change detail', - MODIFY COLUMN `time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT "operation time"; + CHANGE COLUMN `time` `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP COMMENT "operation time"; END IF; END; d// diff --git a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/postgresql/dolphinscheduler_ddl.sql b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/postgresql/dolphinscheduler_ddl.sql index 22e1c599de..ee06588e58 100644 --- a/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/postgresql/dolphinscheduler_ddl.sql +++ b/dolphinscheduler-dao/src/main/resources/sql/upgrade/3.2.2_schema/postgresql/dolphinscheduler_ddl.sql @@ -40,15 +40,16 @@ BEGIN WHERE table_name = 't_ds_audit_log' AND column_name = 'resource_type') THEN -ALTER TABLE t_ds_audit_log -drop resource_type, drop operation, drop resource_id, - add model_id bigint NOT NULL, - add model_name VARCHAR(255) NOT NULL, - add model_type VARCHAR(255) NOT NULL, - add operation_type VARCHAR(255) NOT NULL, - add description VARCHAR(255) NOT NULL, - add latency int NOT NULL, - add detail VARCHAR(255) DEFAULT NULL; + ALTER TABLE t_ds_audit_log + drop resource_type, drop operation, drop resource_id, + add model_id bigint NOT NULL, + add model_name VARCHAR(255) NOT NULL, + add model_type VARCHAR(255) NOT NULL, + add operation_type VARCHAR(255) NOT NULL, + add description VARCHAR(255) NOT NULL, + add latency int NOT NULL, + add detail VARCHAR(255) DEFAULT NULL; + ALTER TABLE t_ds_audit_log RENAME COLUMN "time" TO "create_time"; END IF; END; $$ LANGUAGE plpgsql; diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AuditLogMapperTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AuditLogMapperTest.java index 023b559e79..92418193b8 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AuditLogMapperTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/mapper/AuditLogMapperTest.java @@ -49,7 +49,7 @@ public class AuditLogMapperTest extends BaseDaoTest { auditLog.setModelName("name"); auditLog.setDetail("detail"); auditLog.setLatency(1L); - auditLog.setTime(new Date()); + auditLog.setCreateTime(new Date()); auditLog.setModelType(objectType.getName()); auditLog.setOperationType(AuditOperationType.CREATE.getName()); auditLog.setModelId(1L); diff --git a/dolphinscheduler-ui/src/views/monitor/statistics/audit-log/use-table.ts b/dolphinscheduler-ui/src/views/monitor/statistics/audit-log/use-table.ts index e0a17bbc49..385299d019 100644 --- a/dolphinscheduler-ui/src/views/monitor/statistics/audit-log/use-table.ts +++ b/dolphinscheduler-ui/src/views/monitor/statistics/audit-log/use-table.ts @@ -98,7 +98,7 @@ export function useTable() { }, { title: t('monitor.audit_log.create_time'), - key: 'time', + key: 'createTime', ...COLUMN_WIDTH_CONFIG['time'] } ]