mirror of
https://github.com/silverstripe/silverstripe-mssql
synced 2024-10-22 08:05:53 +02:00
BUGFIX MSSQLDatabase::alterTableAlterColumn() creates ALTER COLUMN clauses twice in the same query for the same column unnecessarily
This commit is contained in:
parent
b772956ce8
commit
00b81bbdd4
@ -622,10 +622,10 @@ class MSSQLDatabase extends SS_Database {
|
||||
if(isset($matches[1])) {
|
||||
//We will prevent any changes being made to the ID column. Primary key indexes will have a fit if we do anything here.
|
||||
if($colName!='ID'){
|
||||
$alterCol .= ";\n$prefix ALTER COLUMN \"$colName\" $matches[1]";
|
||||
|
||||
// SET null / not null
|
||||
if(!empty($matches[2])) $alterCol .= ";\n$prefix ALTER COLUMN \"$colName\" $matches[1] $matches[2]";
|
||||
else $alterCol .= ";\n$prefix ALTER COLUMN \"$colName\" $matches[1]";
|
||||
|
||||
// Add a default back
|
||||
if(!empty($matches[3])) $alterCol .= ";\n$prefix ADD $matches[3] FOR \"$colName\"";
|
||||
|
Loading…
Reference in New Issue
Block a user