1
votes

I have been trying to get Liquibase's maven plugin to work with a simple SQL Changeset.

It's a slightly modified version of the example at: http://www.liquibase.org/manual/formatted_sql_changelogs

-- liquibase formatted sql

-- changeset nvoxland:1

CREATE TABLE test1 (
    id int PRIMARY KEY,
    name varchar(255)
);

CREATE TABLE test2 (
    id int PRIMARY KEY,
    name2 varchar(255)
);

The problem is, it fails with an error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CREATE TABLE test2

If I remove the second create statement, it will succeed.

This happens, when trying to run it with Maven, using the liquibase-plugin. If I run the same changelog file using the command line tool, it will execute without errors.

My liquibase-plugin is of version 1.9.5.0 and liquibase-core is 2.0.5.

The database is MySql 5.5.27 and JDBC Driver is 5.1.24 - I used the same driver with Maven and the command line tool.

1
It looks like your maven plugin doesn't split the sql on ;. Can you try again with org.liquibase:liquibase-maven-plugin:2.0.5?Christoph Leiter
that fixed it! Please post an answer and I will mark it as accepted.wannabeartist

1 Answers

2
votes

The liquibase-plugin is really old (from 2009) and doesn't split the SQL on ;. You should use org.liquibase:liquibase-maven-plugin:2.0.5 instead, which is the current version.