Ruckusing_Adapter_PgSQL_Base::remove_index PHP Метод

remove_index() публичный Метод

Drop an index
public remove_index ( string $table_name, string $column_name, array $options = [] ) : boolean
$table_name string the table name
$column_name string the column name
$options array index options
Результат boolean
    public function remove_index($table_name, $column_name, $options = array())
    {
        if (empty($table_name)) {
            throw new Ruckusing_Exception("Missing table name parameter", Ruckusing_Exception::INVALID_ARGUMENT);
        }
        if (empty($column_name)) {
            throw new Ruckusing_Exception("Missing column name parameter", Ruckusing_Exception::INVALID_ARGUMENT);
        }
        //did the user specify an index name?
        if (is_array($options) && array_key_exists('name', $options)) {
            $index_name = $options['name'];
        } else {
            $index_name = Ruckusing_Util_Naming::index_name($table_name, $column_name);
        }
        $sql = sprintf("DROP INDEX %s", $this->quote_column_name($index_name));
        return $this->execute_ddl($sql);
    }

Usage Example

 /**
  * test remove index with custom index name
  */
 public function test_remove_index_with_custom_index_name()
 {
     //create it
     $table = $this->adapter->create_table('users');
     $table->column('name', 'string', array('limit' => 20));
     $table->column('age', 'integer');
     $table->finish();
     $this->adapter->add_index("users", "name", array('name' => 'my_special_index'));
     $this->assertEquals(true, $this->adapter->has_index("users", "name", array('name' => 'my_special_index')));
     //drop it
     $this->adapter->remove_index("users", "name", array('name' => 'my_special_index'));
     $this->assertEquals(false, $this->adapter->has_index("users", "name", array('name' => 'my_special_index')));
     $this->drop_table('users');
 }
All Usage Examples Of Ruckusing_Adapter_PgSQL_Base::remove_index