-
-
Notifications
You must be signed in to change notification settings - Fork 13
Add ENUM column
#382
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
#382
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #382 +/- ##
============================================
- Coverage 98.00% 97.82% -0.19%
- Complexity 242 250 +8
============================================
Files 26 26
Lines 803 827 +24
============================================
+ Hits 787 809 +22
- Misses 16 18 +2 ☔ 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 in Oracle by leveraging CHECK constraints with IN clauses. Since Oracle doesn't have native ENUM types, the implementation maps ENUM columns to VARCHAR2 with CHECK constraints that restrict values to a predefined list.
Key changes:
- Added regex-based parsing to extract enum values from CHECK constraints in table schemas
- Implemented automatic VARCHAR2 size calculation for ENUM columns based on the longest value
- Refactored buildCheck method to delegate enum constraint generation to the parent class
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Column/EnumColumnTest.php | Adds test cases for enum column detection and validation, including negative test cases for non-enum CHECK constraints |
| tests/Support/IntegrationTestTrait.php | Adds a dropTable helper method for safely dropping tables in tests using PL/SQL error handling |
| src/Schema.php | Implements tryGetEnumValuesFromCheck method to parse CHECK constraints and extract enum values using regex |
| src/Column/ColumnDefinitionBuilder.php | Adds ENUM to VARCHAR2 type mapping with automatic size calculation and refactors buildCheck to use parent implementation for enum constraints |
| CHANGELOG.md | Documents the new enumeration column type support feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Related to yiisoft/db#1107