Example #1
0
 public function equals(Column $otherColumn, $namesOnly = true)
 {
     if (!$this->_table->equals($otherColumn->getTable()) || $this->getName() !== $otherColumn->getName()) {
         return false;
     }
     if ($namesOnly) {
         return true;
     }
     $otherRef = $otherColumn->getReference();
     if ($this->_type !== $otherColumn->getType() || $this->_maxLength && $this->_maxLength !== $otherColumn->getMaxLength() || $this->_allowedValues != $otherColumn->getAllowedValues() || $this->_keyType !== $otherColumn->getKeyType() || $this->_autoIncreased !== $otherColumn->isAutoIncreased() || $this->_optional !== $otherColumn->isOptional() || $this->_defaultValue !== $otherColumn->getDefaultValue() || $this->_reference && !$otherRef || !$this->_reference && $otherRef || $this->_reference && $otherRef && !$this->_reference->equals($otherRef)) {
         return false;
     }
     return true;
 }
Example #2
0
 public function removeColumn(Column $column)
 {
     $name = $this->quoteName($column->getDatabase(), $column->getTable());
     if (!$column->isSynced()) {
         $column->load();
     }
     /* If this column has a reference, we need to drop it first */
     $this->dropConstraint($column);
     $this->dropForeignConstraints($column);
     $this->query("ALTER TABLE {$name} DROP " . $this->quoteName($column));
     return $this;
 }