I'm using Liquibase to update some tables and I seem to run into an error that whenever my .yaml
file has a ;
in it, it throws the error (only put in part of it as it just repeats the same error message):
SEVERE 1/11/18 11:39 AM: liquibase: _master.xml: Tables/Team/Team.updateTeamNames.yaml::1::mayj4: Ch ange Set Tables/Team/Team.updateTeamNames.yaml::1::mayj4 failed. Error: You have an error in your S QL syntax; check the manual that corresponds to your MySQL server version for the right syntax to us e near 'UPDATE Team SET Name ='B' WHERE Name ='Y'; UPDATE Team SET Name ='C' WHERE Name ' at line 1 [Failed SQL: UPDATE Team SET Name = 'A' WHERE Name = 'X'; UPDATE Team SET Name ='B' WHERE Name ='Y'; UPDATE Team SET Name ='C' WHERE Name ='Z'] liquibase.exception.DatabaseException: You have an error in your SQL syntax; check the manual that c orresponds to your MySQL server version for the right syntax to use near 'UPDATE Team SET Name ='B' WHERE Name ='Y'; UPDATE Team SET Name ='C' WHERE Name ' at line 1 [Failed SQL: UPDATE Team SET Name = 'A' WHERE Name = 'X'; UPDATE Team SET Name ='B' WHERE Name ='Y'; UPDATE Team SET Name ='C' WHERE N ame ='Z']
This is the command I am using as well:
liquibase --driver=com.mysql.cj.jdbc.Driver --classpath=C:\mysql-connector-java-8.0.13 --logLevel=severe --changeLogFile=_master.xml --url="jdbc:mysql://localhost:3306/resource?useSSL=false&allowPublicKeyRetrieval=true" --username=root --password=badpassword123 update
Here is the .yaml
file which has the full SQL.
---
databaseChangeLog:
- changeSet:
author: mayj4
id: 1
changes:
- sql:
sql:
UPDATE Team SET Name = 'A' WHERE Name = 'X';
UPDATE Team SET Name ='B' WHERE Name ='Y';
UPDATE Team SET Name ='C' WHERE Name ='Z';
What I'm using
- Liquibase 3.6.2
- MySQL Connector Java 8.0.13
- MySQL Workbench & Server 8.0.13
I've tried adding splitStatements: true
to the .yaml
but this makes no difference as suggested by the Liquibase documentation.
Update 1 It seems when even removing the semi-colons it still fails, so would be to do with running multiple queries.