/** * @group DBAL-42 */ public function testAlterTableColumnComments() { $tableDiff = new TableDiff('mytable'); $tableDiff->addedColumns['quota'] = new \Doctrine\DBAL\Schema\Column('quota', \Doctrine\DBAL\Types\Type::getType('integer'), array('comment' => 'A comment')); $tableDiff->changedColumns['bar'] = new \Doctrine\DBAL\Schema\ColumnDiff('bar', new \Doctrine\DBAL\Schema\Column('baz', \Doctrine\DBAL\Types\Type::getType('string'), array('comment' => 'B comment')), array('comment')); $this->assertEquals($this->getAlterTableColumnCommentsSQL(), $this->_platform->getAlterTableSQL($tableDiff)); }
public function testGeneratesTableAlterationSql() { $expectedSql = $this->getGenerateAlterTableSql(); $columnDiff = new \Doctrine\DBAL\Schema\ColumnDiff('bar', new \Doctrine\DBAL\Schema\Column('baz', \Doctrine\DBAL\Types\Type::getType('string'), array('default' => 'def')), array('type', 'notnull', 'default')); $tableDiff = new \Doctrine\DBAL\Schema\TableDiff('mytable'); $tableDiff->newName = 'userlist'; $tableDiff->addedColumns['quota'] = new \Doctrine\DBAL\Schema\Column('quota', \Doctrine\DBAL\Types\Type::getType('integer'), array('notnull' => false)); $tableDiff->removedColumns['foo'] = new \Doctrine\DBAL\Schema\Column('foo', \Doctrine\DBAL\Types\Type::getType('integer')); $tableDiff->changedColumns['bar'] = $columnDiff; $sql = $this->_platform->getAlterTableSQL($tableDiff); $this->assertEquals($expectedSql, $sql); }