-
-
Notifications
You must be signed in to change notification settings - Fork 13
Add ENUM column
#404
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
Add ENUM column
#404
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #404 +/- ##
============================================
+ Coverage 98.45% 98.48% +0.03%
- Complexity 326 332 +6
============================================
Files 22 22
Lines 1035 1059 +24
============================================
+ Hits 1019 1043 +24
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 support for ENUM column types to the Yiisoft SQLite database driver. Since SQLite doesn't have a native ENUM type, the implementation detects CHECK constraints with IN clauses and treats columns with such constraints as enumeration types. This is a breaking change that removes the previous mapping of 'enum' to string type.
Key changes:
- Implements enum value extraction from CHECK constraints using regex pattern matching
- Maps ENUM column type to 'varchar' in schema definitions
- Adds comprehensive test coverage for various CHECK constraint formats
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| src/Schema.php | Adds tryGetEnumValuesFromCheck() and isCheckNotStartsFromColumnName() methods to parse CHECK constraints and extract enum values |
| src/Column/ColumnFactory.php | Removes 'enum' from the type map (breaking change) |
| src/Column/ColumnDefinitionBuilder.php | Adds mapping for ColumnType::ENUM to 'varchar' type |
| tests/Column/EnumColumnTest.php | Adds SQLite-specific tests for enum column detection from CHECK constraints |
| tests/Provider/ColumnFactoryProvider.php | Removes enum test case from column factory provider |
| CHANGELOG.md | Documents the new enum column type support feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
Copilot reviewed 6 out of 6 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Sergei Tigrov <rrr-r@ya.ru>
Related to yiisoft/db#1107