use of liquibase.changelog.ChangeSet in project liquibase by liquibase.
the class AbstractIntegrationTest method generateChangeLog_noChanges.
@Test
public void generateChangeLog_noChanges() throws Exception {
if (database == null) {
return;
}
runCompleteChangeLog();
DiffResult diffResult = DiffGeneratorFactory.getInstance().compare(database, database, new CompareControl());
DiffToChangeLog changeLogWriter = new DiffToChangeLog(diffResult, new DiffOutputControl(false, false, false, null));
List<ChangeSet> changeSets = changeLogWriter.generateChangeSets();
assertEquals(0, changeSets.size());
}
use of liquibase.changelog.ChangeSet in project iaf by ibissource.
the class LiquibaseImpl method update.
public void update() {
List<String> changes = new ArrayList<String>();
try {
List<ChangeSet> changeSets = liquibase.listUnrunChangeSets(contexts, labelExpression);
for (ChangeSet changeSet : changeSets) {
changes.add("LiquiBase applying change [" + changeSet.getId() + ":" + changeSet.getAuthor() + "] description [" + changeSet.getDescription() + "]");
}
if (changeSets.size() > 0) {
liquibase.update(contexts);
ChangeSet lastChange = changeSets.get(changeSets.size() - 1);
String tag = lastChange.getId() + ":" + lastChange.getAuthor();
tag(tag);
if (changes.size() > 1) {
log("LiquiBase applied [" + changes.size() + "] change(s) and added tag [" + tag + "]");
} else {
for (String change : changes) {
log(change + " tag [" + tag + "]");
}
}
}
} catch (Exception e) {
e.printStackTrace();
String errorMsg = "Error running LiquiBase update. Failed to execute [" + changes.size() + "] change(s): ";
errorMsg += e.getMessage();
ConfigurationWarnings.getInstance().add(log, errorMsg, e);
}
}
use of liquibase.changelog.ChangeSet in project minijax by minijax.
the class LiquibaseHelper method validateDatabaseState.
/**
* Validates that the database is in a good state.
*
* @param database The database.
* @param fileName The change log file name.
* @param resourceAccessor The change log file loader.
*/
private void validateDatabaseState(final Database database) throws LiquibaseException {
final Liquibase liquibase = getLiquibase(database);
// all contexts
final Contexts contexts = new Contexts();
// no filters
final LabelExpression labels = new LabelExpression();
final List<ChangeSet> unrunChangeSets = liquibase.listUnrunChangeSets(contexts, labels);
if (!unrunChangeSets.isEmpty()) {
throw new IllegalStateException("Unrun change sets! Please migrate the database first");
}
}
use of liquibase.changelog.ChangeSet in project minijax by minijax.
the class LiquibaseHelperTest method testNotIgnoreEmptyChangeSet.
@Test
public void testNotIgnoreEmptyChangeSet() {
final ChangeSet changeSet = new ChangeSet(null);
assertFalse(LiquibaseHelper.isIgnoredChangeSet(changeSet));
}
use of liquibase.changelog.ChangeSet in project minijax by minijax.
the class LiquibaseHelperTest method testNotIgnoreDropOtherTable.
@Test
public void testNotIgnoreDropOtherTable() {
final DropTableChange change = new DropTableChange();
change.setTableName("foo");
final ChangeSet changeSet = new ChangeSet(null);
changeSet.addChange(change);
assertFalse(LiquibaseHelper.isIgnoredChangeSet(changeSet));
}
Aggregations