Create trigger for H2 with liquibase

Viewed 610

I'm using JHipster and I'm trying to update a table and add a trigger using liquibase. The DB used when running the service is postgres, but when running the tests jhipster uses H2. With the following code everything is ok with postgres, but not with H2

<changeSet id="1" author="jhipster" runOnChange="true">
        <createProcedure>
            CREATE TRIGGER date_trigger_set
            BEFORE update
            ON alert
            FOR EACH ROW
            BEGIN
                NEW.updated_at = NOW();
            END;
        </createProcedure>
        <rollback>
            drop trigger date_trigger_set
        </rollback>
</changeSet>

For H2, when running tests, I get:

java.lang.IllegalStateException
        Caused by: org.springframework.beans.factory.BeanCreationException
            Caused by: liquibase.exception.MigrationFailedException
                Caused by: liquibase.exception.DatabaseException
                    Caused by: org.h2.jdbc.JdbcSQLException

Is it possible to create a trigger for H2 with liquibase? Am I doing something wrong?

Thank you

0 Answers
Related