1
列
空值,我創建一個觸發器這樣之後,如果在
CREATE TRIGGER trigger_academictermregistration AFTER UPDATE ON academictermregistration FOR EACH ROW
BEGIN
DECLARE summary TEXT(65535);
SET summary = '';
IF(NEW.version <> OLD.version) THEN
SET summary = concat(summary, ' @VER: ', OLD.version, '-->', NEW.version);
END IF;
IF(NEW.isDeleted <> OLD.isDeleted) THEN
SET summary = concat(summary, ' @IS_DELETED: ', OLD.isDeleted, '-->', NEW.isDeleted);
END IF;
INSERT INTO auditinfo (entityId, entityName, importance, details, modifiedOn, modifiedBy)
VALUE (NEW.id, 'AcademicTermRegistration', 1, summary, NOW(), NEW.modifiedBy);
IF(NEW.id <> OLD.id) THEN
INSERT INTO auditinfo (entityId, entityName, importance, details, timestamp, user_id)
VALUE (OLD.id, 'AcademicTermRegistration', 5, concat('ID: ', OLD.id, '-->', NEW.id), NOW(), 'backend');
END IF;
END
更新觸發器沒有相應工作,我有一個這樣的觸發器,這是更新表後,但如果跟蹤的列值所做的更改任何值爲空(表示爲isDeleted),然後將該值更新爲非空。審計信息表中沒有細節