Ruckusing_Adapter_PgSQL_Base::remove_column PHP Method

remove_column() public method

Drop a column
public remove_column ( string $table_name, string $column_name ) : boolean
$table_name string the table name
$column_name string the column name
return boolean
    public function remove_column($table_name, $column_name)
    {
        $sql = sprintf("ALTER TABLE %s DROP COLUMN %s", $this->quote_table_name($table_name), $this->quote_column_name($column_name));
        return $this->execute_ddl($sql);
    }

Usage Example

 /**
  * test dropping column
  */
 public function test_remove_column()
 {
     $this->drop_table('users');
     //create it
     $table = $this->adapter->create_table('users');
     $table->column('name', 'string', array('limit' => 20));
     $table->column('age', 'integer');
     $table->finish();
     //verify it exists
     $col = $this->adapter->column_info("users", "name");
     $this->assertEquals("name", $col['field']);
     //drop it
     $this->adapter->remove_column("users", "name");
     //verify it does not exist
     $col = $this->adapter->column_info("users", "name");
     $this->assertEquals(null, $col);
     $this->drop_table('users');
 }
All Usage Examples Of Ruckusing_Adapter_PgSQL_Base::remove_column