0
votes

I have many sql files for creating or replacing views and I want to reuse them through sqlFile in liquibase changelog instead of using createView xml tag.

I use:

<sqlFile path="VI_NAME.sql" relativeToChangelogFile="true"/>

Instead:

<createView viewName="VI_NAME" replaceIfExists="true">
    SELECT
    ...
</createView>

But views not created with this approach! I debug the way using createView and sql generated by liquibae is the same as in sql file (only schema is added to view name - but this doesn't solve my problem)

PS: Logging for sqlFile: SQL in file VI_NAME.sql executed

Liquibase Version: 3.1.1

1
You can try to use also a sql file which does not exist to see what message will be displayed in the liquibase log file.Andrei Bozantan
Hm.. seems like liquibase does't write that file not exists.. I have mistake in my paths(art
I was wondering if that was the problem. That bug is fixed in the upcoming 3.2.0 releaseNathan Voxland

1 Answers

0
votes

Use runOnChange attribute.

<changeSet author="liquibase" id="my_view" runOnChange="true"><sqlFile path="VI_NAME.sql"/>
</changeSet>