fix(mariadb): emit NOCYCLE/NOCACHE on ALTER SEQUENCE#64
Merged
Conversation
… CYCLE")
The ALTER SEQUENCE path built its statement directly and never routed through
MariaDB's wrapCreateSequence normalizer, so a MODIFIED sequence emitted
`... NO CYCLE CACHE 1000`. MariaDB requires the single tokens NOCYCLE/NOCACHE and
rejects the spaced form ("syntax error near 'CYCLE CACHE 1000'"), which aborted
and rolled back the whole migration.
Add a `wrapAlterSequence` dialect hook (mirroring wrapCreateSequence) and have
the MariaDB dialect apply the same NO CYCLE→NOCYCLE / NO CACHE→NOCACHE
normalization, factored into a shared helper so the CREATE and ALTER paths stay
in sync. Default is a no-op, so Postgres/DB2/SQL Server/Oracle are unaffected.
Found by the web E2E suite (mariadb went from FAIL to 10/10; full suite 6/6 green).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The web E2E suite surfaced a MariaDB migration failure. When a sequence differs between source and target, the generator's
ALTER SEQUENCEpath built its statement directly and — unlike theCREATE SEQUENCEpath — never routed through MariaDB'swrapCreateSequencenormalizer. So it emitted:MariaDB requires the single tokens
NOCYCLE/NOCACHEand rejects the spaced form:That aborted and rolled back the entire migration (2 MariaDB E2E assertions failed).
Fix
wrapAlterSequence(qualifiedName, alterSql)dialect hook, mirroring the existingwrapCreateSequence. Default is a no-op — Postgres/DB2/SQL Server/Oracle are unaffected (they acceptNO CYCLE/NO CACHE).NO CYCLE→NOCYCLE/NO CACHE→NOCACHEnormalization is factored into a sharednormalizeSequenceTokenshelper used by both the CREATE and ALTER paths, so they can't drift again.Test plan
NOCYCLE/NOCACHEand neverNO CYCLE/NO CACHEnpx vitest run— 242 passed, 2 skippedcd apps/web && npx tsc --noEmit— cleanexit 0)🤖 Generated with Claude Code