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
CREATE SEQUENCE DATAFEED_ID_SEQ START WITH 523194 CYCLE;

-- 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):
     APP_ERR_LOG_ID_SEQ
          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
ALTER SEQUENCE AD2_SID_SEQ;

-- changeset bigpet01-pa:1663616629511-2
ALTER SEQUENCE APPS_CAP_ID_SEQ;

-- changeset bigpet01-pa:1663616629511-3
ALTER SEQUENCE APP_ERR_LOG_ID_SEQ;

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