title: Get Current User for Delete Trigger - Spring MyBatis - Liquibase
body: <p>I have a Spring services project that uses MyBatis and Liquibase.
  I've made an audit table that has triggers for INSERT/UPDATE/DELETE.</p>
  
  <p>With INSERT/UPDATE I'm already storing the user id so it's not a problem to do NEW.USER_ID, but with DELETE I only have OLD.USER_ID which obviously doesn't reflect the current user making the change.</p>
  
  <p>Excluding some info, I have this in liquibase (putting *s around what should change):</p>
  
  <pre><code>    &lt;sql endDelimiter="|"&gt;
          CREATE TRIGGER DELETE_TRIGGER
          AFTER DELETE
          ON TABLE_NAME
          FOR EACH ROW
          BEGIN
          INSERT INTO TABLE_NAME_A (CHANGE_TYPE, CHANGE_ID, CHANGE_DATE)
          VALUES ('DELETE', **OLD.USER_ID**, now());
          END;
          |
      &lt;/sql&gt;
  </code></pre>
  
  <p>So I'm not sure what to replace OLD.UPDATE_ID with.
  The other examples I found often have to do with sql servers and mssql. So maybe I just failed as searching as I didn't find something that could work within spring/mybatis/liquibase/mysql.</p>