From 365bdc23d0c3752c396017443fe86e9dfc35423b Mon Sep 17 00:00:00 2001 From: zYne Date: Wed, 13 Jun 2007 21:11:36 +0000 Subject: [PATCH] enhanced mysql driver foreign key support --- lib/Doctrine/Export/Mysql.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) 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 *