refactor: enhance extra info handling for table columns in ClickHouse#1479
Conversation
There was a problem hiding this comment.
Pull request overview
This PR enhances how the ClickHouse data access object handles the extra field in table column metadata by introducing a new method to build more comprehensive column information.
- Introduced a new
buildExtraInfomethod to construct theextrafield value based on both primary key status and auto-increment detection patterns - Updated column structure mapping to use the new method instead of simple conditional logic
- Enhanced auto-increment detection to support ClickHouse-specific functions like
generateuuidv4,generateuuid,rownumberinallblocks, and other generation patterns
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| lowerDefault.includes('nextval') || | ||
| lowerDefault.includes('generate') |
There was a problem hiding this comment.
The condition lowerDefault.includes('generate') is too broad and will incorrectly flag many default expressions that aren't auto-increment related. For example, it would match expressions like "regenerate_token()", "generate_report()", or any string containing the word "generate". This could lead to false positives where columns are incorrectly marked as having auto_increment behavior.
Consider either removing this catch-all condition or making it more specific to ClickHouse auto-generation functions. The more specific checks above it (generateuuidv4, generateuuid, etc.) should be sufficient for most cases.
| lowerDefault.includes('nextval') || | |
| lowerDefault.includes('generate') | |
| lowerDefault.includes('nextval') |
No description provided.