Example #1
0
 /**
  * Drop a column if it exists
  *
  * @param \Zend\Log\Logger $logger Logger instance
  * @param \Nada\Database\AbstractDatabase $database Database object
  * @param string $column column name
  * @codeCoverageIgnore
  */
 protected function _dropColumnIfExists($logger, $database, $column)
 {
     $tables = $database->getTables();
     if (isset($tables[$this->table])) {
         $table = $tables[$this->table];
         $columns = $table->getColumns();
         if (isset($columns[$column])) {
             $logger->notice("Dropping column {$this->table}.{$column}...");
             $table->dropColumn($column);
             $logger->notice('done.');
         }
     }
 }