use of liquibase.change.core.AlterSequenceChange in project liquibase by liquibase.
the class ChangedSequenceChangeGenerator method fixChanged.
@Override
public Change[] fixChanged(DatabaseObject changedObject, ObjectDifferences differences, DiffOutputControl control, Database referenceDatabase, Database comparisonDatabase, ChangeGeneratorChain chain) {
Sequence sequence = (Sequence) changedObject;
List<Change> changes = new ArrayList<Change>();
if (differences.isDifferent("incrementBy")) {
AlterSequenceChange change = createAlterSequenceChange(sequence, control);
change.setIncrementBy(sequence.getIncrementBy());
changes.add(change);
}
if (differences.isDifferent("maxValue")) {
AlterSequenceChange change = createAlterSequenceChange(sequence, control);
change.setMaxValue(sequence.getMaxValue());
changes.add(change);
}
if (differences.isDifferent("ordered")) {
AlterSequenceChange change = createAlterSequenceChange(sequence, control);
change.setOrdered(sequence.getOrdered());
changes.add(change);
}
if (differences.isDifferent("cacheSize")) {
AlterSequenceChange change = createAlterSequenceChange(sequence, control);
change.setCacheSize(sequence.getCacheSize());
changes.add(change);
}
if (differences.isDifferent("willCycle")) {
AlterSequenceChange change = createAlterSequenceChange(sequence, control);
change.setCycle(sequence.getWillCycle());
changes.add(change);
}
if (changes.size() == 0) {
return null;
} else {
return changes.toArray(new Change[changes.size()]);
}
}
use of liquibase.change.core.AlterSequenceChange in project liquibase by liquibase.
the class ChangedSequenceChangeGenerator method createAlterSequenceChange.
protected AlterSequenceChange createAlterSequenceChange(Sequence sequence, DiffOutputControl control) {
AlterSequenceChange change = new AlterSequenceChange();
if (control.getIncludeCatalog()) {
change.setCatalogName(sequence.getSchema().getCatalogName());
}
if (control.getIncludeSchema()) {
change.setSchemaName(sequence.getSchema().getName());
}
change.setSequenceName(sequence.getName());
return change;
}
Aggregations