Commit 4dd8a6d2 authored by Benjamin Eberlei's avatar Benjamin Eberlei

Fix SQLServer Rename Table Tests and implementation

parent 00ac50c0
...@@ -317,10 +317,6 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -317,10 +317,6 @@ class SQLServerPlatform extends AbstractPlatform
$sql = array(); $sql = array();
$columnSql = array(); $columnSql = array();
if ($diff->newName !== false) {
$queryParts[] = "sp_RENAME '" . $diff->name . "', '" . $diff->newName . "'";
}
foreach ($diff->addedColumns as $column) { foreach ($diff->addedColumns as $column) {
if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) { if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
continue; continue;
...@@ -370,6 +366,10 @@ class SQLServerPlatform extends AbstractPlatform ...@@ -370,6 +366,10 @@ class SQLServerPlatform extends AbstractPlatform
$sql = array_merge($sql, $this->_getAlterTableIndexForeignKeySQL($diff)); $sql = array_merge($sql, $this->_getAlterTableIndexForeignKeySQL($diff));
if ($diff->newName !== false) {
$sql[] = "sp_RENAME '" . $diff->name . "', '" . $diff->newName . "'";
}
return array_merge($sql, $tableSql, $columnSql); return array_merge($sql, $tableSql, $columnSql);
} }
......
...@@ -28,11 +28,11 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase ...@@ -28,11 +28,11 @@ class SQLServerPlatformTest extends AbstractPlatformTestCase
public function getGenerateAlterTableSql() public function getGenerateAlterTableSql()
{ {
return array( return array(
'ALTER TABLE mytable RENAME TO userlist',
'ALTER TABLE mytable ADD quota INT DEFAULT NULL', 'ALTER TABLE mytable ADD quota INT DEFAULT NULL',
'ALTER TABLE mytable DROP COLUMN foo', 'ALTER TABLE mytable DROP COLUMN foo',
'ALTER TABLE mytable ALTER COLUMN baz NVARCHAR(255) DEFAULT \'def\' NOT NULL', 'ALTER TABLE mytable ALTER COLUMN baz NVARCHAR(255) DEFAULT \'def\' NOT NULL',
'ALTER TABLE mytable ALTER COLUMN bloo BIT DEFAULT \'0\' NOT NULL', 'ALTER TABLE mytable ALTER COLUMN bloo BIT DEFAULT \'0\' NOT NULL',
"sp_RENAME 'mytable', 'userlist'",
); );
} }
......
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