Exemplo n.º 1
0
 /**
  * dropIndex
  *
  * @param string $name
  * @param bool   $constraint
  *
  * @return mixed
  */
 public function dropIndex($name, $constraint = false)
 {
     if ($constraint) {
         $query = PostgresqlQueryBuilder::dropConstraint($this->table, $name, true, 'RESTRICT');
     } else {
         $query = PostgresqlQueryBuilder::dropIndex($name, true);
     }
     $this->db->setQuery($query)->execute();
     return $this;
 }
 /**
  * Method to test dropIndex().
  *
  * @return void
  *
  * @covers Windwalker\Query\Postgresql\PostgresqlQueryBuilder::dropIndex
  */
 public function testDropIndex()
 {
     $expected = "ALTER TABLE {$this->qn}foo{$this->qn} DROP INDEX {$this->qn}bar{$this->qn}";
     $actual = PostgresqlQueryBuilder::dropIndex('foo', 'INDEX', 'bar');
     $this->assertEquals(\SqlFormatter::compress($expected), \SqlFormatter::compress($actual));
 }
 /**
  * Method to test dropIndex().
  *
  * @return void
  *
  * @covers Windwalker\Query\Postgresql\PostgresqlQueryBuilder::dropIndex
  */
 public function testDropIndex()
 {
     $expected = "DROP INDEX {$this->qn('bar')}";
     $actual = PostgresqlQueryBuilder::dropIndex('bar');
     $this->assertEquals($this->format($expected), $this->format($actual));
     $expected = "DROP INDEX CONCURRENTLY IF EXISTS {$this->qn('bar')}";
     $actual = PostgresqlQueryBuilder::dropIndex('bar', true, true);
     $this->assertEquals($this->format($expected), $this->format($actual));
 }