Introspect zero defaults on SingleStore numeric columns#5954
Open
greymoth-jp wants to merge 1 commit into
Open
Introspect zero defaults on SingleStore numeric columns#5954greymoth-jp wants to merge 1 commit into
greymoth-jp wants to merge 1 commit into
Conversation
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.
Introspecting (
drizzle-kit pull) a SingleStoresmallint,mediumint,bigint,float,doubleorrealcolumn whoseDEFAULTis0drops the default from the generated schema.Each of those branches in
introspect-singlestore.tsguards.default()with a plain truthy check on the default value:0is falsy, so it is treated as "no default" and the generated TypeScript loses it, even though the introspected snapshot stores the0correctly. A fresh pull then stops matching the database. Theintandtinyintbranches in the same file already guard withtypeof defaultValue !== 'undefined'; this applies the same check to the remaining numeric branches.This is the SingleStore counterpart of #5917 (MySQL float/double/real) and #5918 (MySQL smallint/mediumint/bigint) — the SingleStore introspector has the same branches with the same truthy guard.
I scoped the change to the numeric types covered by those two PRs and left
booleanuntouched. I didn't add a test because the introspect suite starts a SingleStore container, which I couldn't run locally; happy to mirror the tests from #5917/#5918 if you'd prefer one here.