Search in sources :

Example 1 with CreateSequenceChange

use of liquibase.change.core.CreateSequenceChange in project liquibase by liquibase.

the class MissingSequenceChangeGenerator method fixMissing.

@Override
public Change[] fixMissing(DatabaseObject missingObject, DiffOutputControl control, Database referenceDatabase, Database comparisonDatabase, ChangeGeneratorChain chain) {
    Sequence sequence = (Sequence) missingObject;
    CreateSequenceChange change = new CreateSequenceChange();
    change.setSequenceName(sequence.getName());
    if (control.getIncludeCatalog()) {
        change.setCatalogName(sequence.getSchema().getCatalogName());
    }
    if (control.getIncludeSchema()) {
        change.setSchemaName(sequence.getSchema().getName());
    }
    change.setStartValue(sequence.getStartValue());
    change.setIncrementBy(sequence.getIncrementBy());
    change.setMinValue(sequence.getMinValue());
    change.setMaxValue(sequence.getMaxValue());
    change.setCacheSize(sequence.getCacheSize());
    change.setCycle(sequence.getWillCycle());
    change.setOrdered(sequence.getOrdered());
    return new Change[] { change };
}
Also used : Sequence(liquibase.structure.core.Sequence) CreateSequenceChange(liquibase.change.core.CreateSequenceChange) Change(liquibase.change.Change) CreateSequenceChange(liquibase.change.core.CreateSequenceChange)

Aggregations

Change (liquibase.change.Change)1 CreateSequenceChange (liquibase.change.core.CreateSequenceChange)1 Sequence (liquibase.structure.core.Sequence)1