Exemplo n.º 1
0
 public function generateForeignKeyExpression(Database\Definition\ForeignKey $foreignKey)
 {
     return new SimpleExpression(' CONSTRAINT ? FOREIGN KEY (?) REFERENCES ? (?)??', new Symbol($foreignKey->getName()), Symbol::prepareColumns($foreignKey->getLocalColumns()), new Symbol($foreignKey->getReferencedTable()->schemaName), Symbol::prepareColumns($foreignKey->getReferenceColumns()), new Raw($foreignKey->onUpdate === ForeignKey::NO_ACTION ? '' : ' ON UPDATE ' . $foreignKey->onUpdate), new Raw($foreignKey->onDelete === ForeignKey::NO_ACTION ? '' : ' ON DELETE ' . $foreignKey->onDelete));
 }
Exemplo n.º 2
0
 public function addForeignKey(ForeignKey $foreignKey)
 {
     //$foreignKey->getReferencedTable()->dependentTables [$this->schemaName]= $this;
     $this->foreignKeys[$foreignKey->getName()] = $foreignKey;
     foreach ($foreignKey->getLocalColumns() as $column) {
         $this->columnForeignKeys[$column->propertyName] = $foreignKey;
     }
     return $this;
 }