Reputation: 9
I'm trying to connect to the multiple databases and create tables, but when migrating flyway gets syntax error.
This is the migration file I'm trying to run:
\c testdatabase;
CREATE TABLE testtable1;
\c testdatabase2;
CREATE TABLE testtable2;
Flyway gives this output:
Error Code : 0
Message : ERROR: syntax error at or near "\"
Position: 1
Line : 1
Statement : \c testdatabase
It seems like flyway does not support meta-commands like "\c" for connecting to the database. Is there any other way to do connect to the databases and create a table?
Upvotes: 0
Views: 394
Reputation: 667
The error comes (as indicated in the error input) from the comment lines preceding your two SQL statements in the script: \c testdatabase;
which are not valid SQL syntax for comments.
You could simply correct those faulty lines like the following: -- testdatabase
, and generally, the error input already gives you a hint as to where lies the problem.
Upvotes: 1