Reputation: 3992
I want to change a view which already exists. Isn't there something like \changeView or \alterView in Liquibase?
I already created a view with createView. I tried to use google and search for alterview or changeview, but without any proper results.
Upvotes: 1
Views: 14614
Reputation: 467
Because of some reasons, I could not change or replace my view using either <sql>
or <createView>
tags. So, I created sql file with my view definition, and in my changeset I have included this sql file using <sqlFile>
tag. This tag has attribute dbms
and it is required, so, do not forget to write correct one. In this way I have changed/updated my existing view. Hope this helps to someone like me.
Upvotes: 0
Reputation: 101
I know this question is 6 years ago, but can be util for so today.
Liquibase has an option for <createView>
which is replaceIfExists="yourBooleanOpt"
. So you can use:
<createView
viewName="yourViewName"
replaceIfExists="true">
yourSqlViewSintax
</createView>
Upvotes: 5
Reputation: 7324
There is a replaceIfExists
attribute on createView
that will replace an existing view.
http://www.liquibase.org/documentation/changes/create_view.html
Upvotes: 13
Reputation: 78001
The simplest approach is to drop the old view and create a new one. Re-creating a view does not affect your data.
Upvotes: 5