Doctrine DBAL
  1. Doctrine DBAL
  2. DBAL-678

[GH-426] [DBAL-569] Add support for column comments / commented types in SQL Server


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.5
    • Component/s: None
    • Security Level: All
    • Labels:


      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.


        Doctrine Bot added a comment -

        A related Github Pull-Request [GH-426] was closed:

        Doctrine Bot added a comment - A related Github Pull-Request [GH-426] was closed:


          • Assignee:
            Benjamin Eberlei
            Doctrine Bot
          • Votes:
            0 Vote for this issue
            1 Start watching this issue


            • Created: