Skip to content

Add ENUM column#415

Merged
vjik merged 3 commits intomasterfrom
enum-col
Nov 30, 2025
Merged

Add ENUM column#415
vjik merged 3 commits intomasterfrom
enum-col

Conversation

@vjik
Copy link
Copy Markdown
Member

@vjik vjik commented Nov 25, 2025

Q A
Is bugfix?
New feature? ✔️
Breaks BC? ✔️

Related to yiisoft/db#1107

@vjik vjik mentioned this pull request Nov 25, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.64%. Comparing base (0f41835) to head (724c325).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master     #415      +/-   ##
============================================
+ Coverage     98.62%   98.64%   +0.02%     
- Complexity      247      251       +4     
============================================
  Files            26       26              
  Lines           800      812      +12     
============================================
+ Hits            789      801      +12     
  Misses           11       11              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vjik vjik marked this pull request as ready for review November 29, 2025 10:27
@vjik vjik requested review from a team, Tigrov and Copilot November 29, 2025 10:27
@vjik vjik added the status:code review The pull request needs review. label Nov 29, 2025
Copy link
Copy Markdown

Copilot AI left a 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 the MSSQL database driver. Since MSSQL doesn't have a native ENUM type, this implementation uses NVARCHAR columns with CHECK constraints to simulate enum behavior.

Key Changes:

  • Enum value extraction from CHECK constraints via regex pattern matching
  • ENUM type mapping to NVARCHAR with appropriate CHECK constraint generation
  • Comprehensive test coverage including edge cases for non-enum CHECK constraints

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
src/Schema.php Adds tryGetEnumValuesFromCheck() method to extract enum values from MSSQL CHECK constraint definitions and integrates it into column loading
src/Column/ColumnDefinitionBuilder.php Adds ENUM type mapping to nvarchar and refactors buildCheck() to delegate to parent class for ENUM handling
tests/Column/EnumColumnTest.php Adds MSSQL-specific enum column tests, including negative test cases for non-enum CHECK 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.

@vjik vjik merged commit da8aab3 into master Nov 30, 2025
20 checks passed
@vjik vjik deleted the enum-col branch November 30, 2025 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status:code review The pull request needs review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants