Datetime2 column type not supported in SQL Server
Open
Nobody has claimed this yet.
bug
- Dominant language
- PHP
- Stars
- 4.5k
- Forks
- 884
- PR merge metrics
- No merged PRs in 30d
Description
Attempting to rename a column of type 'datetime2(6)' on SQL Server results in phinx complaining,
[RuntimeException]
The SqlServer type: "datetime2" is not supported
This is a pretty simple fix I think. In my case, I accomplished the migration by making the following modification in SqlServerAdapter::getPhinxType - line 965-968:
case 'datetime':
+ case 'datetime2':
case 'timestamp':
return static::PHINX_TYPE_DATETIME;
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in SqlServerAdapter::getPhinxType around lines 965–968 and inspect how SQL Server column types are mapped. Verify that datetime2(6) is recognized during a column rename without the unsupported-type exception; the issue does not name a test file, so use the existing SQL Server adapter coverage if available.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100