Liquibase generateChangeLog generates no data at all

434 views Asked by At

I want to dump some data with liquibase maven plugin from a legacy database. So I ran this command :

mvn liquibase:generateChangeLog -Poracle. The build ran successfully with no errors, but the output file (01-initial-data-dump) is empty.

It also displayed this message :

BEST PRACTICE: The changelog generated by diffChangeLog/generateChangeLog should be inspected for correctness and completeness before being deployed.
[INFO] changeSets count: 0
[INFO] No changesets to add.
Generated changelog written to /Volumes/WORKSPACE/shipping/shipping-infra/src/main/resources/db/changelogs/01-initial-data-dump.xml

Here is the configuration of my pom.xml :

<profile>
        <id>oracle</id>
        <activation>
            <activeByDefault>false</activeByDefault>
        </activation>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.liquibase</groupId>
                    <artifactId>liquibase-maven-plugin</artifactId>
                    <version>4.5.0</version>
                    <configuration>
                        <promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
                        <changeLogFile>${project.basedir}/src/main/resources/db/changelog.xml</changeLogFile>
                        <outputChangeLogFile>${project.basedir}/src/main/resources/db/changelogs/01-initial-data-dump.xml</outputChangeLogFile>
                        <diffChangeLogFile>${project.basedir}/src/main/resources/db/changelogs/${maven.build.timestamp}_changelog.xml</diffChangeLogFile>
                        <driver>oracle.jdbc.OracleDriver</driver>
                        <url></url>
                        <username></username>
                        <password></password>
                        <referenceUrl>hibernate:spring:com.myapp.myentities?dialect=org.hibernate.dialect.Oracle12cDialect&amp;hibernate.physical_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringPhysicalNamingStrategy&amp;hibernate.implicit_naming_strategy=org.springframework.boot.orm.jpa.hibernate.SpringImplicitNamingStrategy</referenceUrl>
                        <verbose>true</verbose>
                        <logging>debug</logging>
                        <diffTypes>data</diffTypes>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>org.liquibase</groupId>
                            <artifactId>liquibase-core</artifactId>
                            <version>4.5.0</version>
                        </dependency>
                        <dependency>
                            <groupId>org.liquibase.ext</groupId>
                            <artifactId>liquibase-hibernate5</artifactId>
                            <version>4.5.0</version>
                        </dependency>
                         <!-- more dependencies -->
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </profile>

I am sure that there are datas in my database but I don't know why the file is still empty.

Am I missing something ?

1

There are 1 answers

0
Dimitri On

I finally found the cause of why generateChangeLog was producing an empty file and it has nothing to do with the liquibase maven plugin configuration.

The problem was the table in the schema was defined as synonyms, and they reference the real tables defined in another schema.

It seems that liquibase cannot generate changelogs based on synonyms.

Hope this help someone in the future