Commit c458fe72 authored by Steve Müller's avatar Steve Müller

fix SQL Server default constraint name generation for quoted identifiers

parent 1a9408c5
...@@ -322,11 +322,13 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -322,11 +322,13 @@ class SQLServerPlatform extends AbstractPlatform
throw new \InvalidArgumentException("Incomplete column definition. 'default' required."); throw new \InvalidArgumentException("Incomplete column definition. 'default' required.");
} }
$columnName = new Identifier($column['name']);
return return
' CONSTRAINT ' . ' CONSTRAINT ' .
$this->generateDefaultConstraintName($table, $column['name']) . $this->generateDefaultConstraintName($table, $column['name']) .
$this->getDefaultValueDeclarationSQL($column) . $this->getDefaultValueDeclarationSQL($column) .
' FOR ' . $column['name']; ' FOR ' . $columnName->getQuotedName($this);
} }
/** /**
...@@ -1519,6 +1521,9 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -1519,6 +1521,9 @@ class SQLServerPlatform extends AbstractPlatform
*/ */
private function generateIdentifierName($identifier) private function generateIdentifierName($identifier)
{ {
return strtoupper(dechex(crc32($identifier))); // Always generate name for unquoted identifiers to ensure consistency.
$identifier = new Identifier($identifier);
return strtoupper(dechex(crc32($identifier->getName())));
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment