Conversation
closes #132
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #133 +/- ##
============================================
+ Coverage 74.14% 74.26% +0.12%
- Complexity 2087 2101 +14
============================================
Files 53 53
Lines 5198 5223 +25
============================================
+ Hits 3854 3879 +25
Misses 1344 1344
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
Auto-map column data types between database engines in
ColumnFactory::create(). When a type is not natively supported by the target engine (e.g.DataType::TEXTon MSSQL), the factory now consultsTypesMap::MAPto find the equivalent type automatically.Motivation
DataType::TEXTand other MySQL-only types throwDatabaseExceptionwhen used in MSSQL table definitions, making it impossible to write cross-database schemas. Fixes #132.Changes
resolveDatatype()toColumnFactory— looks up type mappings across all registered engines inTypesMap::MAPwhen the type is not native to the target engine. Scales to any number of engines.getDefaultMappedSize()toColumnFactory— provides sensible default sizes when an unsized type (e.g.text) maps to a sized type (e.g.nvarchar). Explicit sizes in the column definition always take precedence.MSSQLColumnTestfor MySQL → MSSQL auto-mapping (text, mediumtext, blob variants, double, timestamp, explicit size preservation, native type passthrough).MySQLColumnTestfor MSSQL → MySQL auto-mapping (bigint, binary, date, datetime2, money, nchar, nvarchar, time, varbinary, native type passthrough).How to Test / Verify
Unit tests cover all type mappings in both directions:
php vendor/bin/phpunit -c tests/phpunit.xml --filter "testAutoMap|testNativeTypes|testAutoMapPreserves"20 new tests, 47 assertions. Full suite: 606 tests, 0 regressions.
Breaking Changes and Migration Steps
None. Native types pass through unchanged. The auto-mapping only activates when a type is not in the target engine's supported list.
Checklist
Related issues
Closes #132