Details
-
Type:
Bug
-
Status:
Resolved
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 1.2.1
-
Fix Version/s: 1.2.3
-
Component/s: Migrations
-
Labels:None
-
Environment:PHP 5.3
MSSQL Server 2008
Description
SQL Server will not allow attempts to alter or drop columns with indexes or constraints applied to them, because they are dependent on the column. In addition to this, SQL Server's syntax for altering columns is different for that of adding them in that it does not allow default value constraints to be present in the alter statement.
I've attached a patch which attempts to circumvent this issue by allowing the author of the changeset to provide a name for the default constraint, which SQL Server supports. Giving the constraint a name of our choosing allows us to reference and drop it before running a command against a constrained column.
In the case of an ALTER query the default constraint portion is spliced and subsequently run.
When dropping a column the author need only make sure they name the constraint, or know its name, then drop it before the query is run.
Added patch and test cases for this issue.