Skip to content

Commit

Permalink
[CORE-227] Only insert into AUDIT_WORKFLOW_STATUS when the workflow s…
Browse files Browse the repository at this point in the history
…tatus changes (#3155)
  • Loading branch information
marctalbott authored Dec 19, 2024
1 parent c5560b5 commit 8281027
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -130,4 +130,5 @@
<include file="changesets/20241106_streamline_workspace_attr_temp_table_procedure.xml" relativeToChangelogFile="true"/>
<include file="changesets/20241120_rename_submission_cost_cap_threshold.xml" relativeToChangelogFile="true"/>
<include file="changesets/20241121_billing_account_changes_status.xml" relativeToChangelogFile="true"/>
<include file="changesets/20241218_alter_audit_workflow_status_trigger_frequency.xml" relativeToChangelogFile="true"/>
</databaseChangeLog>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<databaseChangeLog logicalFilePath="dummy" xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
xmlns:ext="http://www.liquibase.org/xml/ns/dbchangelog-ext"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog-ext http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-ext.xsd http://www.liquibase.org/xml/ns/dbchangelog https://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-4.30.xsd">
<changeSet id="alter_audit_workflow_status_trigger_frequency" author="mtalbott" logicalFilePath="dummy">
<sql>
DROP TRIGGER IF EXISTS after_workflow_update;
</sql>
<sql splitStatements="false">
CREATE TRIGGER after_workflow_update
AFTER UPDATE ON WORKFLOW
FOR EACH ROW
BEGIN
IF NEW.STATUS != OLD.STATUS THEN
INSERT INTO AUDIT_WORKFLOW_STATUS
(workflow_id, status, timestamp)
VALUES
(NEW.ID, NEW.STATUS, NEW.STATUS_LAST_CHANGED);
END IF;
END
</sql>
</changeSet>
</databaseChangeLog>

0 comments on commit 8281027

Please sign in to comment.