| @@ 188-207 (lines=20) @@ | ||
| 185 | ); |
|
| 186 | } |
|
| 187 | ||
| 188 | public function testGeneratesTableAlterationWithRemovedColumnCommentSql() |
|
| 189 | { |
|
| 190 | $table = new Table('mytable'); |
|
| 191 | $table->addColumn('foo', 'string', array('comment' => 'foo comment')); |
|
| 192 | ||
| 193 | $tableDiff = new TableDiff('mytable'); |
|
| 194 | $tableDiff->fromTable = $table; |
|
| 195 | $tableDiff->changedColumns['foo'] = new ColumnDiff( |
|
| 196 | 'foo', |
|
| 197 | new Column('foo', Type::getType('string')), |
|
| 198 | array('comment') |
|
| 199 | ); |
|
| 200 | ||
| 201 | self::assertEquals( |
|
| 202 | array( |
|
| 203 | "COMMENT ON COLUMN mytable.foo IS NULL" |
|
| 204 | ), |
|
| 205 | $this->_platform->getAlterTableSQL($tableDiff) |
|
| 206 | ); |
|
| 207 | } |
|
| 208 | ||
| 209 | /** |
|
| 210 | * @dataProvider getLockHints |
|
| @@ 325-337 (lines=13) @@ | ||
| 322 | ); |
|
| 323 | } |
|
| 324 | ||
| 325 | public function testAlterTableAddColumns() |
|
| 326 | { |
|
| 327 | $diff = new TableDiff('user'); |
|
| 328 | $diff->addedColumns['foo'] = new Column('foo', Type::getType('string')); |
|
| 329 | $diff->addedColumns['count'] = new Column('count', Type::getType('integer'), array('notnull' => false, 'default' => 1)); |
|
| 330 | ||
| 331 | $expected = array( |
|
| 332 | 'ALTER TABLE user ADD COLUMN foo VARCHAR(255) NOT NULL', |
|
| 333 | 'ALTER TABLE user ADD COLUMN count INTEGER DEFAULT 1', |
|
| 334 | ); |
|
| 335 | ||
| 336 | self::assertEquals($expected, $this->_platform->getAlterTableSQL($diff)); |
|
| 337 | } |
|
| 338 | ||
| 339 | /** |
|
| 340 | * @dataProvider complexDiffProvider |
|