I finally found the cause of the problem.
In my script, I had:
... ... INSERT INTO `table_1` (`id`, `string_1`, `string_2`) VALUES ( 1, 'aaa', 'bbb' ); INSERT INTO `table_2` (`id`, `string_3`) VALUES ( 1, 'cccc' );
The problems seem to be on COMMENT 2 and COMMENT 4. If I delete the flyway theme, all my migration scripts will succeed.
For example, this script will work:
... ... INSERT INTO `table_1` (`id`, `string_1`, `string_2`) VALUES ( 1, 'aaa', 'bbb' ); INSERT INTO `table_2` (`id`, `string_3`) VALUES ( 1, 'cccc' );
So, maybe this is a bug in the Flyway parser?
I don’t have time to test it today, but it seems like this error only occurs when:
- We have a comment after VARCHAR (or other column types that I assume)
- This comment is placed immediately before the ')' symbol
These problems seem reproducible only if several insert statements are present in the same SQL script.
In addition, I believe that comments that are not placed before the ')' character are correct, for example:
INSERT INTO `table_2` (`id`, `string_3`) VALUES ( 1, 'cccc', 'dddd' );
Here COMMENT 3 and COMMENT 4 pass in Flyway, because they are located after the character ',' and before the string value, but they do not fit before the character ')'.
Hope this can help; -)