I'm running into the issue with liquibase parsing sql file. Looks like it does not recognize ';' as a delimiter. If I keep just one statement without ';' in the end it runs fine, but obviously I need to execute the complete set of commands. My sql looks like that:
CREATE TABLE network_area (
network_area_id NUMBER(18) NOT NULL,
name VARCHAR2(30 CHAR) NOT NULL );
ALTER TABLE network_area ADD CONSTRAINT network_area_pk PRIMARY KEY (network_area_id );
ALTER TABLE network_area ADD CONSTRAINT network_area__un UNIQUE ( name );
my liquibase plugin looks like that:
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.6.2</version>
<configuration>
<propertyFile>src/test/resources/liquibase/liquibase.properties</propertyFile>
<changeLogFile>src/test/resources/liquibase/ddl/my-ddl.sql</changeLogFile>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
The error I'm getting is:
Caused by: java.sql.SQLSyntaxErrorException: ORA-00922: missing or invalid option Caused by: Error : 922, Position : 121, Sql = CREATE TABLE network_area ( network_area_id NUMBER(18) NOT NULL, name VARCHAR2(30 CHAR) NOT NULL );
I ended up going with alternative, setting up flywaydb. This is my configuration example for anyone who finds it useful:
<plugin>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-maven-plugin</artifactId>
<configuration>
<configFile>src/test/resources/flyway/flyway.properties</configFile>
<locations>
<location>filesystem:src/test/resources/flyway/migration</location>
<location>filesystem:src/test/resources/flyway/dataload</location>
</locations>
</configuration>
<dependencies>
<dependency>
<groupId>com.oracle.ojdbc</groupId>
<artifactId>ojdbc8</artifactId>
<version>12.2.0.1.p27350958</version>
</dependency>
</dependencies>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>migrate</goal>
</goals>
<phase>test</phase>
</execution>
</executions>
</plugin>