Affects Version/s: None
Fix Version/s: 2.5
Security Level: All
This issue is created automatically through a Github pull request on behalf of deeky666:
SQL Server has no native support for column comments. Therefore commented types are currently not supported for SQL Server leading to repeated ALTER TABLE statements by schema tool when using types that require column comments.
However there is a way to store column comments. Using SQL Server's extended properties functionality, it is possible to store metadata for columns. This is also the way SQL Server Management Studio stores "Description" property for columns.
This PR implements this to be able to use comments for columns and enable support for commented types.
The PR is not 100% finished, yet as we need to find a way to generate the correct statements in the following table alteration scenarios:
- Renamed column that also requires a comment change (either due to changed comment or change from or to a commented type that required/requires a column comment change.
- Changed column where `$columnDiff->fromColumn` is not set.
Using extended properties we need to know whether a column comment has to be added, updated or removed in order to generate the appropriate SQL statement. This is due to SQL Server having a different stored procedure for each operation. Using the wrong stored procedure leads to an error.
Therefore we always need to know the type and comment information from the column to change from in a table alteration scenario. Unfortunately we don't have that if a column is marked as renamed in the table diff or if it is marked as changed but no `$columnDiff->fromColumn` is set (this is the case in some tests actually).
Awaiting feedback how to proceed in thos scenarios.