/** * Method to test alterColumn(). * * @return void * * @covers Windwalker\Query\Postgresql\PostgresqlQueryBuilder::alterColumn */ public function testAlterColumn() { $expected = "ALTER TABLE {$this->qn}foo{$this->qn} MODIFY {$this->qn}bar{$this->qn} int(11) UNSIGNED NOT NULL DEFAULT '1' COMMENT 'Test' FIRST"; $actual = PostgresqlQueryBuilder::alterColumn('MODIFY', 'foo', 'bar', 'int(11)', true, true, '1', 'FIRST', 'Test'); $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual)); $expected = "ALTER TABLE {$this->qn}foo{$this->qn} CHANGE {$this->qn}bar{$this->qn} {$this->qn}yoo{$this->qn} text AFTER {$this->qn}id{$this->qn}"; $actual = PostgresqlQueryBuilder::alterColumn('CHANGE', 'foo', array('bar', 'yoo'), 'text', false, false, null, 'AFTER id', null); $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual)); }
/** * Method to test alterColumn(). * * @return void * * @covers Windwalker\Query\Postgresql\PostgresqlQueryBuilder::alterColumn */ public function testAlterColumn() { $expected = "ALTER TABLE {$this->qn('foo')} ADD {$this->qn('bar')} int(11) NOT NULL SET DEFAULT '1'"; $actual = PostgresqlQueryBuilder::alterColumn('ADD', 'foo', 'bar', 'int(11)', true, '1'); $this->assertEquals($this->format($expected), $this->format($actual)); $expected = "ALTER TABLE {$this->qn('foo')} RENAME {$this->qn('bar')} TO {$this->qn('yoo')}"; $actual = PostgresqlQueryBuilder::alterColumn('RENAME', 'foo', array('bar', 'yoo'), null, false, null); $this->assertEquals($this->format($expected), $this->format($actual)); }