Hi,
Some DB entities have dependencies. e.g a view / stored procedure depends on views / tables it uses. Is there a way to handle it with xml changelog?
In my scenario ViewB uses ViewA. To change ViewA steps required:
I have the following changesets:
Some DB entities have dependencies. e.g a view / stored procedure depends on views / tables it uses. Is there a way to handle it with xml changelog?
In my scenario ViewB uses ViewA. To change ViewA steps required:
- ViewB needs to be dropped.
- ViewA needs to be changed
- ViewB needs to be recreated
I have the following changesets:
<changeSet id="Create ViewA" runOnChange="true" ...>
<createView viewName="ViewA" replaceIfExists="true" .../></changeSet>
<changeSet id="Create ViewB" runOnChange="true" ...>
<createView viewName="ViewB" remarks="Uses ViewA" .../></changeSet>
- dropView throws an error if the view does not exists so that needs to be in a separate changeSet with precondition
- dropView should have an option 'ifExists' avoiding error if the view does not exists
- dropView could have an option to drop all dependent objects. (The dependency can be retrieved from the DB.)
- Some way to call or ask another changeSet to be executed later. In that case if a dependent view (ViewA) has been changed. The changeset drops the depending view(s) (ViewB) and ask liquibase to execute the changesets recreating it. This feature could be used in many other cases. liquibase only needs to change the flag if a changeSet needs to be executed.
- Similar: changeSet could have a 'dependsOn' option listing the changesets it depends on. If the depended changeset was executed, execute this also even if not changed
- precondition similar to changeSetExecuted (or just a option) to check if a changeSet was executed in the current execution.
Thanks,
Gyula Bibernáth