Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ADD COLUMN IF NOT EXISTS in MariaDB generates a Flyway Parsing Error #2794

Closed
ngintherBW opened this issue Apr 29, 2020 · 1 comment
Closed

Comments

@ngintherBW
Copy link

ngintherBW commented Apr 29, 2020

Which version and edition of Flyway are you using?

Flyway Community Edition 6.4.0 by Redgate installed via Brew

If this is not the latest version, can you reproduce the issue with the latest one as well?

(Many bugs are fixed in newer releases and upgrading will often resolve the issue)
Yes, I upgraded my CLI just before submitting this issue.

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

CLI via brew
I also use the Maven plugin, but have not tested this change there yet.

Which database are you using (type & version)?

MariaDB 10.3.22 with InnoDB schema

Which operating system are you using?

macOS Catalina 10.15.4

What did you do?

(Please include the content causing the issue, any relevant configuration settings, the SQL statement that failed (if relevant) and the command you ran.)
ALTER TABLE mydb.quantities ADD COLUMN IF NOT EXISTS quantity_name VARCHAR(150) DEFAULT NULL;

What did you expect to see?

The migration to succeed with a new column created in the schema if the column did not previously exist in the schema.

What did you see instead?

ERROR: Unable to parse statement in /V7__Refactor.sql at line 9 col 1: Incomplete statement at line 9 col 1: ALTER TABLE mydb.quantities ADD COLUMN IF NOT EXISTS quantity_name VARCHAR(150) DEFAULT NULL;

Removing the "IF NOT EXISTS" text from the SQL works allows the migration to work. Running the SQL directly in MariaDB 10.3.22 also works.

@MikielAgutu
Copy link

MikielAgutu commented Apr 30, 2020

Fixed by 9235c04

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants