diff --git a/lib/Doctrine/Export/Mysql.php b/lib/Doctrine/Export/Mysql.php index dd55c904e..ddbb2718f 100644 --- a/lib/Doctrine/Export/Mysql.php +++ b/lib/Doctrine/Export/Mysql.php @@ -569,6 +569,28 @@ class Doctrine_Export_Mysql extends Doctrine_Export } return implode(', ', $declFields); } + /** + * getAdvancedForeignKeyOptions + * Return the FOREIGN KEY query section dealing with non-standard options + * as MATCH, INITIALLY DEFERRED, ON UPDATE, ... + * + * @param array $definition + * @return string + */ + public function getAdvancedForeignKeyOptions($definition) + { + $query = ''; + if (!empty($definition['match'])) { + $query .= ' MATCH ' . $definition['match']; + } + if (!empty($definition['on_update'])) { + $query .= ' ON UPDATE ' . $this->getForeignKeyRefentialAction($definition['onUpdate']); + } + if (!empty($definition['on_delete'])) { + $query .= ' ON DELETE ' . $this->getForeignKeyRefentialAction($definition['onDelete']); + } + return $query; + } /** * drop existing index *