phinx
phinx copied to clipboard
Datetime2 column type not supported in SQL Server
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;
I think it would only take a small amount of additional work to fully support the datetime2 variable precision timestamp - specifying the length option to a datetime type might be a good strategy, even though the result would vary by platform.
Anyone wants to make a PR here? Otherwise we close this as this is a very old ticket.