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
 protected function dropConstraint(Column $column, $dropIndex = false)
 {
     $ref = $column->getReference();
     if (!$ref) {
         return;
     }
     $table = $column->getTable();
     $fkName = $this->getConstraintName($column);
     $tbl = $this->quoteName($table->getDatabase(), $table);
     $this->query("ALTER TABLE {$tbl} DROP FOREIGN KEY {$fkName}");
     if ($dropIndex) {
         $this->dropIndex($column);
     }
 }