Skip to content

fix: clean up obsolete serial sequences - #806

Merged
zachdaniel merged 1 commit into
ash-project:mainfrom
jechol:drop-obsolete-serial-sequences
Jul 26, 2026
Merged

fix: clean up obsolete serial sequences#806
zachdaniel merged 1 commit into
ash-project:mainfrom
jechol:drop-obsolete-serial-sequences

Conversation

@jechol

@jechol jechol commented Jul 26, 2026

Copy link
Copy Markdown
Contributor

Changing a generated ID from an implicit bigserial default to an explicit default leaves its owned sequence behind. This causes migrated schemas to differ from freshly generated schemas.

This change removes obsolete sequences in the correct order and restores them in reverse migrations. Restored sequences are initialized from the column's current maximum value.

Regression tests cover both transition directions. I also verified that migrated and freshly generated schemas match in a downstream application.

This pull request description was drafted with AI assistance and reviewed by the submitter.

Contributor checklist

Leave anything that you believe does not apply unchecked.

  • I accept the AI Policy, or AI was not used in the creation of this PR.
  • Bug fixes include regression tests
  • Chores
  • Documentation changes
  • Features include unit/acceptance tests
  • Refactoring
  • Update dependencies

@jechol
jechol marked this pull request as ready for review July 26, 2026 09:26

@zachdaniel zachdaniel left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clever

@zachdaniel
zachdaniel merged commit a219e32 into ash-project:main Jul 26, 2026
116 of 121 checks passed
@jechol
jechol deleted the drop-obsolete-serial-sequences branch July 26, 2026 23:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants