-
-
Notifications
You must be signed in to change notification settings - Fork 12
Add ColumnDefinitionParser
#405
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #405 +/- ##
============================================
+ Coverage 98.45% 98.48% +0.03%
- Complexity 326 328 +2
============================================
Files 22 23 +1
Lines 1035 1058 +23
============================================
+ Hits 1019 1042 +23
Misses 16 16 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a ColumnDefinitionParser implementation for the SQLite database driver, which is part of refactoring to support parsing column definition strings into structured information. The parser extends AbstractColumnDefinitionParser from the yiisoft/db package and implements SQLite-specific type parameter parsing logic.
Key changes:
- Introduces
ColumnDefinitionParserclass that handles parsing of column type parameters for SQLite-specific types - Integrates the parser into
ColumnFactoryvia thecolumnDefinitionParser()method - Adds corresponding test coverage via
ColumnDefinitionParserTest
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/Column/ColumnDefinitionParser.php | New parser class implementing SQLite-specific column definition parsing logic with support for size/precision parameters on various data types |
| src/Column/ColumnFactory.php | Adds columnDefinitionParser() method that returns the new ColumnDefinitionParser instance |
| tests/ColumnDefinitionParserTest.php | Test class extending common test suite to verify parser functionality |
| CHANGELOG.md | Documents the addition of the new ColumnDefinitionParser class |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
| return match ($type) { | ||
| 'bit', | ||
| 'char', | ||
| 'datetime', | ||
| 'datetimetz', | ||
| 'decimal', | ||
| 'double', | ||
| 'float', | ||
| 'int', | ||
| 'numeric', | ||
| 'real', | ||
| 'smallint', | ||
| 'string', | ||
| 'time', | ||
| 'timestamp', | ||
| 'timetz', | ||
| 'tinyint', | ||
| 'varchar' => $this->parseSizeInfo($params), | ||
| default => [], | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's right to limit the number of possible types for parsing. What about integer, bigint, varbit, character, etc. Sqlite supports various type names.
Related to yiisoft/db#1108