/**
  * @param \Doctrine\ORM\Tools\Event\SchemaAlterTableRemoveColumnEventArgs $args
  */
 public function onSchemaAlterTableRemoveColumn(SchemaAlterTableRemoveColumnEventArgs $args)
 {
     $column = $args->getColumn();
     if (!$column->getType() instanceof \Doctrine\Spatial\DBAL\Types\Type) {
         return;
     }
     $platform = $args->getPlatform();
     $diff = $args->getTableDiff();
     $tableName = $diff->newName !== false ? $diff->newName : $diff->name;
     $args->preventDefault()->addSql($this->getDropColumnSQL($tableName, $column->getQuotedName($platform), $column->getNotnull()));
 }
 public function onSchemaAlterTableRemoveColumn(SchemaAlterTableRemoveColumnEventArgs $args)
 {
     $column = $args->getColumn();
     if (!$this->isSpatialColumnType($column)) {
         return;
     }
     if ('geometry' !== $column->getType()->getName() || $this->schemaManager->isPostGis2()) {
         return;
     }
     $platform = $args->getPlatform();
     $diff = $args->getTableDiff();
     $table = new Identifier(false !== $diff->newName ? $diff->newName : $diff->name);
     if ($column->getNotnull()) {
         // Remove NOT NULL constraint from the field
         $args->addSql(sprintf('ALTER TABLE %s ALTER %s SET DEFAULT NULL', $table->getQuotedName($platform), $column->getQuotedName($platform)));
     }
     // We use DropGeometryColumn() to also drop entries from the geometry_columns table
     $args->addSql(sprintf("SELECT DropGeometryColumn('%s', '%s')", $table->getName(), $column->getName()));
     $args->preventDefault();
 }