|
@@ 136-155 (lines=20) @@
|
| 133 |
|
$this->assertEquals($expectedSql, $query->getDescription()); |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
public function renameTableProvider() |
| 137 |
|
{ |
| 138 |
|
return [ |
| 139 |
|
[new MySqlPlatform(), 'ALTER TABLE old_table RENAME TO new_table'], |
| 140 |
|
[new PostgreSqlPlatform(), 'ALTER TABLE old_table RENAME TO new_table'], |
| 141 |
|
[new OraclePlatform(), 'ALTER TABLE old_table RENAME TO new_table'], |
| 142 |
|
[ |
| 143 |
|
new SQLServer2005Platform(), |
| 144 |
|
[ |
| 145 |
|
"sp_RENAME 'old_table', 'new_table'", |
| 146 |
|
"DECLARE @sql NVARCHAR(MAX) = N''; " |
| 147 |
|
. "SELECT @sql += N'EXEC sp_rename N''' + dc.name + ''', N'''" |
| 148 |
|
. " + REPLACE(dc.name, '50BD45A0', 'EBFCC9B') + ''', ''OBJECT'';' " |
| 149 |
|
. "FROM sys.default_constraints dc JOIN sys.tables tbl ON dc.parent_object_id = tbl.object_id " |
| 150 |
|
. "WHERE tbl.name = 'new_table';" |
| 151 |
|
. "EXEC sp_executesql @sql" |
| 152 |
|
] |
| 153 |
|
], |
| 154 |
|
]; |
| 155 |
|
} |
| 156 |
|
|
| 157 |
|
public function renameColumnProvider() |
| 158 |
|
{ |
|
@@ 190-215 (lines=26) @@
|
| 187 |
|
]; |
| 188 |
|
} |
| 189 |
|
|
| 190 |
|
public function addForeignKeyConstraintProvider() |
| 191 |
|
{ |
| 192 |
|
return [ |
| 193 |
|
[ |
| 194 |
|
new MySqlPlatform(), |
| 195 |
|
'ALTER TABLE test_table ADD CONSTRAINT fk_test_table_local_column ' |
| 196 |
|
. 'FOREIGN KEY (local_column) REFERENCES foreign_table (foreign_column) ON DELETE CASCADE' |
| 197 |
|
], |
| 198 |
|
[ |
| 199 |
|
new PostgreSqlPlatform(), |
| 200 |
|
'ALTER TABLE test_table ADD CONSTRAINT fk_test_table_local_column ' |
| 201 |
|
. 'FOREIGN KEY (local_column) REFERENCES foreign_table (foreign_column) ON DELETE CASCADE ' |
| 202 |
|
. 'NOT DEFERRABLE INITIALLY IMMEDIATE' |
| 203 |
|
], |
| 204 |
|
[ |
| 205 |
|
new OraclePlatform(), |
| 206 |
|
'ALTER TABLE test_table ADD CONSTRAINT fk_test_table_local_column ' |
| 207 |
|
. 'FOREIGN KEY (local_column) REFERENCES foreign_table (foreign_column) ON DELETE CASCADE' |
| 208 |
|
], |
| 209 |
|
[ |
| 210 |
|
new SQLServer2005Platform(), |
| 211 |
|
'ALTER TABLE test_table ADD CONSTRAINT fk_test_table_local_column ' |
| 212 |
|
. 'FOREIGN KEY (local_column) REFERENCES foreign_table (foreign_column) ON DELETE CASCADE' |
| 213 |
|
], |
| 214 |
|
]; |
| 215 |
|
} |
| 216 |
|
} |
| 217 |
|
|