How to ignore sequence start value during diff

I’m using Liquibase 4.8 because later versions have broken needed functionality.

I’m finding a couple of issues related to sequences when running generatechangelog against an oracle schema, requiring extensive edits before running the generated changelog to create a new schema.

  1. The startValue is being set to the current value in the source schema. In most cases, when we build a new schema, we want this to be either the minValue or 1.
  2. If the sequence includes the cycle option, then the maxValue must be specified for the command to run without error, however, the maxValue is missing from some (but not all) generated sequence changesets that have the CYCLE attribute, requiring these be edited to add the maxValue. e.g.:
-- changeset bigpet01-pa:1663277030155-8

-- changeset bigpet01-pa:1663277030155-9
CREATE SEQUENCE ETQ_SID_SEQ START WITH 15498321 MAXVALUE 9999999999999999999999999999 CYCLE;

When running a diff report where reference is set to the source schema where generatechangelog was run, against a new schema build from the generated changelog, I get differences for every sequence related to having to modify these values. E.g.

Changed Sequence(s):
          maxValue changed from 'null' to '9999999999999999999999999999'
          startValue changed from '8141319' to '1'

In addition, the diff-changelog command wants to alter every sequence but provides no changes. E.g.

-- liquibase formatted sql

-- changeset bigpet01-pa:1663616629511-1

-- changeset bigpet01-pa:1663616629511-2

-- changeset bigpet01-pa:1663616629511-3

Is there a way to avoid such issues without having to write a bunch of post-processing code?

Hi, @pbiggs - Thank you for asking this!

The answer to your question seems to be “it depends.” I did some searching and found a couple of resources that should help, but I couldn’t find a direct answer. Some of these reference posts are pretty old, so keep in mind that things may have been updated or changed, and the documentation site is always your best bet for the most up-to-date information.

  1. Ignore items in Liquibase diff - Stack Overflow
  2. Syntax to eliminate Sequences from my createChangeLog command line call?
  3. Best Practices for Using Diffs