| 1 | |
package org.liquibase.maven.plugins; |
| 2 | |
|
| 3 | |
import liquibase.exception.LiquibaseException; |
| 4 | |
import liquibase.Liquibase; |
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | 4 | public class LiquibaseUpdate extends AbstractLiquibaseUpdateMojo { |
| 14 | |
|
| 15 | |
|
| 16 | |
|
| 17 | |
|
| 18 | |
|
| 19 | |
|
| 20 | |
protected boolean dropFirst; |
| 21 | |
|
| 22 | |
@Override |
| 23 | |
protected void doUpdate(Liquibase liquibase) throws LiquibaseException { |
| 24 | 0 | if (dropFirst) { |
| 25 | 0 | liquibase.dropAll(); |
| 26 | |
} |
| 27 | |
|
| 28 | 0 | if (changesToApply > 0) { |
| 29 | 0 | liquibase.update(changesToApply, contexts); |
| 30 | |
} else { |
| 31 | 0 | liquibase.update(contexts); |
| 32 | |
} |
| 33 | 0 | } |
| 34 | |
|
| 35 | |
@Override |
| 36 | |
protected void printSettings(String indent) { |
| 37 | 0 | super.printSettings(indent); |
| 38 | 0 | getLog().info(indent + "drop first? " + dropFirst); |
| 39 | |
|
| 40 | 0 | } |
| 41 | |
} |