Search in sources :

Example 6 with Sequence

use of liquibase.structure.core.Sequence 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

Sequence (liquibase.structure.core.Sequence)6 Change (liquibase.change.Change)3 ArrayList (java.util.ArrayList)1 AlterSequenceChange (liquibase.change.core.AlterSequenceChange)1 CreateSequenceChange (liquibase.change.core.CreateSequenceChange)1 DropSequenceChange (liquibase.change.core.DropSequenceChange)1 DatabaseSnapshot (liquibase.snapshot.DatabaseSnapshot)1 Schema (liquibase.structure.core.Schema)1