Add default value syntax support for bake migration command#970
Merged
Add default value syntax support for bake migration command#970
Conversation
Adds support for specifying default column values in the bake migration command using the syntax: `column:type:default[value]` Examples: - `active:boolean:default[true]` - `count:integer:default[0]` - `status:string:default['pending']` Supports booleans, integers, floats, strings (quoted), null, and SQL expressions like CURRENT_TIMESTAMP. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Return null when default value is an empty string (no default specified) instead of returning the empty string itself. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
- Fix return type annotation for getTypeAndLength() using tuple syntax - Convert string lengths to integers for proper type safety - Add null coalescing operator for columnType parameter 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Verify that lengths are returned as integers (not strings) and that precision/scale arrays contain integers for proper type safety. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Member
Author
|
Fun fact:
and it errored out. So that made me think: Sounds reasonable to expect this API yeah |
- Update column pattern to include default[value] - Document supported value types (boolean, int, float, string, null, SQL) - Add practical examples showing default values in action - Show how to combine defaults with other options 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <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
bake migrationcommand using a newdefault[value]syntaxExamples
Supported Value Types
true,false0,123,-4561.5,-2.75'hello'or"world"(quoted)nullorNULLCURRENT_TIMESTAMP(passed through as-is)Test plan
parseDefaultValue()methodparseFields()with default valuesparseIndexes()with default valuesvalidArguments()with default values🤖 Generated with Claude Code