一夜无眠,再加上@Jens建议,我终于明白了这个问题。
首先,如果您看到我的帖子,则该错误不是我所认为的SQL错误。我以为
AFTER INSERT是引发错误的原因,但这是
AFTER UPDATE
关键是确保设置
splitStatements:false,
endDelimiter而无需设置。
这是两个有效的示例:
<changeSet id="event_horizon_1_0_1" author="lmtyler" dbms="mysql"> <sqlFile splitStatements="false" stripComments="false" path="01__ai_event_approval.sql" relativeToChangelogFile="true"/></changeSet>
与此SQL文件
CREATE DEFINER ='evclient'@'%' TRIGGER ai_event_approval AFTER INSERT ON event_approval FOR EACH rowbegin insert into event_approval_log (rowAction, actionTs, event, requestorEmail, requestReason, statusType, approverUserId, approverReason, lastChangTs) values ('I', current_timestamp(6), new.event, new.requestorEmail, new.requestReason, new.statusType, new.approverUserId, new.approverReason, new.lastChangTs);end;
这是使用SQL格式
--changeset lmtyler:event_horizon_1_0_1 dbms:mysql splitStatements:falseCREATE TRIGGER au_event_approval AFTER UPDATE ON event_approval FOR EACH rowbegin insert into event_approval_log (rowAction, actionTs, event, requestorEmail, requestReason, statusType, approverUserId, approverReason, lastChangTs) values ('U', current_timestamp(6), new.event, new.requestorEmail, new.requestReason, new.statusType, new.approverUserId, new.approverReason, new.lastChangTs);end;
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)