Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: EXPOSED-85 Add support for changing default value in SQL Server #1812

Merged
merged 2 commits into from
Aug 11, 2023

Commits on Aug 11, 2023

  1. feat: Add support for changing default value in SQL Server

    When creating a column with a DEFAULT value in SQL Server, a DEFAULT constraint is created under the hood. To modify the default value of a column, the constraint has to be dropped first. To do that, the name of the constraint is needed. To be able to obtain its name easily, the way the DEFAULT constraint is created was modified to give it an explicit name with the format DF_TableName_ColumnName. So when adding a new DEFAULT value to a column or modifying an existing one, it's necessary to drop the existing DEFAULT constraint first, and then add a new one.
    joc-a committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    66f7d65 View commit details
    Browse the repository at this point in the history
  2. fix: Change the way modifyColumn constructs its statements because th…

    …e previous version was not including all necessary modifications
    
    Every alter statement will be a separate item in the list returned by the modifyColumn function. The statement to alter the default value of a column will combine both the DROP CONSTRAINT and ADD CONSTRAINT statements in one String item, separated by a semicolon. The statement to alter the type and nullability will be part of one String item since that syntax is allowed in SQL Server, but it seems like it's not allowed for adding and dropping constraints.
    joc-a committed Aug 11, 2023
    Configuration menu
    Copy the full SHA
    ed02776 View commit details
    Browse the repository at this point in the history