updateSQL generates invalid SQL for multi statement SQL (triggers, procedures)

Description

For CI/CD on non production environments I use the liquibase update command to continuously update databases. For production I would like to be able to generate the SQL required to migrate the database, so that I can review the changes before actually applying them. So there I use the updateSQL command.

However, when defining multi statement sql changes, to define for example a trigger the generated SQL file is not valid for MySQL / MariaDB. The Delimiter statements are missing.

I found a pull request, that looks like it will fix this issue. The pull request is from 2015 so I guess it will not be merged soon.

https://github.com/liquibase/liquibase/pull/377


Steps to reproduce

Given the following changelog:

Running the update command using the MariaDB driver against an empty database works flawlessly:

Running the updateSQL command using the MariaDB driver against an empty database:

Generates this SQL:

Applying this SQL against an empty database using the MariaDB mysql client fails:

This is because of the multi statement trigger. The delimiter is not set to `//` in the generated SQL.

Actual generated trigger:

I expect the generated trigger to look like:

Environment

  • MySQL / MariaDB

  • Change sql

  • Change sqlFile

  • updateSQL command

Reporter

MrVirage

Components

Affects versions

Priority

Major
Configure