Repository navigation
fix(migrate-ts): regex CHECK on a varchar/text column no longer reads as drift on Postgres - #463
Merged
Merged
Conversation
… as drift on Postgres
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.
What Changed
meta verify --dbon Postgres no longer reports a regexCHECKon atext/varchar/bpcharcolumn as dropped-and-added. Postgres stores"key" ~ '…'as((key)::text ~ '…'::text); the comparison already folded the literal's::textbut not the column's.normalizeCheckExprandcheckExprEqualsnow take an optional set of text-family column names and drop(col)::textbefore~,~*,!~and!~*.citextand every other column type keep the cast, because it changes the operator there.udt_nameon a new optionalColumnDescriptor.udtName.diffTableChecksbuilds the text-family column set from it and passes it to the comparison.CHANGELOG.mdentry, unit tests for normalization and offline diff, and a Postgres integration test (pg-regex-check-cast.test.ts, skipped unlessMIGRATE_TS_PG_URLis set).Risk Assessment
Low. A
(col)::textcast folds away before a regex operator only when the introspected Postgres column is text, varchar or bpchar. Every other caller keeps strict comparison.Testing
::text-cast check vs uncast authored check reads as drift (citext negative)scripts/ci-local.sh --only ts-fast --only ts-unit --strict-toolchainson the PR head: exit 0 (build and typecheck, TypeScript conformance, unit suites, mutation gate all green).Pipeline
Validated by no-mistakes in one run (CI is local; no forge checks run).
::textfor every column hides a change oncitext; fixed by gating the rule on text-family column types, with acitextnegative test.codegen-tstypecheck; the scratch was removed and the local CI above was re-run green. The test step was then approved over the earlier failed-command finding (recorded as an override with no reason supplied), on the strength of that green re-run.