-
-
Notifications
You must be signed in to change notification settings - Fork 46
Add ENUM column
#1107
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
#1107
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1107 +/- ##
=========================================
Coverage 98.62% 98.62%
- Complexity 1648 1655 +7
=========================================
Files 119 120 +1
Lines 4283 4305 +22
=========================================
+ Hits 4224 4246 +22
Misses 59 59 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Co-authored-by: Sergei Tigrov <rrr-r@ya.ru>
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 dedicated EnumColumn type to the Yii database abstraction layer, removing the generic enumValues property from the base Column class. This is a breaking change that provides better type safety and clearer API for enum columns.
Key Changes:
- Introduces
EnumColumnclass extendingStringColumnwith dedicatedvalues()andgetValues()methods - Removes
enumValues()andgetEnumValues()methods fromColumnInterfaceandAbstractColumn - Adds
ColumnBuilder::enum()factory method for creating enum columns - Updates
AbstractColumnDefinitionBuilderto generate CHECK constraints for enum columns when dbType is null (for databases without native ENUM support)
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/Schema/Column/EnumColumn.php |
New dedicated enum column class with values management |
src/Schema/Column/ColumnBuilder.php |
Adds enum() factory method for creating enum columns |
src/Schema/Column/AbstractColumn.php |
Removes generic enumValues property and methods |
src/Schema/Column/ColumnInterface.php |
Removes enumValues() and getEnumValues() from interface |
src/Schema/Column/AbstractColumnFactory.php |
Maps ColumnType::ENUM to EnumColumn class |
src/Schema/Column/ColumnFactoryInterface.php |
Updates psalm type to use values instead of enumValues |
src/QueryBuilder/AbstractColumnDefinitionBuilder.php |
Generates CHECK constraints for enum columns without dbType |
src/Syntax/ColumnDefinitionParser.php |
Renames enumValues to values in parser output |
src/Constant/ColumnType.php |
Adds ENUM constant for the enum column type |
tests/Db/Schema/Column/EnumColumnTest.php |
Unit tests for EnumColumn class |
tests/Common/CommonEnumColumnTest.php |
Integration tests for enum column functionality |
tests/Provider/ColumnProvider.php |
Updates test data providers for enum columns |
tests/Provider/ColumnFactoryProvider.php |
Adds enum column to factory type tests |
tests/Provider/ColumnDefinitionParserProvider.php |
Updates parser test data to use values |
tests/Provider/ColumnBuilderProvider.php |
Removes getEnumValues from default values test |
tests/Support/IntegrationTestCase.php |
Adds helper methods dropTable() and executeStatements() |
tests/Db/Schema/Column/ColumnTest.php |
Removes tests for deprecated enumValues methods |
CHANGELOG.md |
Documents the new enum column type feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Related PRs:
ENUMcolumn db-pgsql#465ENUMcolumn db-sqlite#404ENUMcolumn db-mssql#415ENUMcolumn db-mysql#448ENUMcolumn db-oracle#382