Commit 563377cc authored by Jonathan.Wage's avatar Jonathan.Wage

Fix for missing sql when creating tables for model with templates that result in addition tables

parent e33130b8
......@@ -1073,15 +1073,16 @@ class Doctrine_Export extends Doctrine_Connection_Module
}
$sql = $this->exportClassesSql(array($class));
// The create sql query is the first one, and everything else is the alters
$create = $sql[0];
// Remove create from the main array
unset($sql[0]);
// Build array of all the creates
// We need these to happen first
foreach ($sql as $key => $query) {
if (strstr($query, 'CREATE')) {
$connections[$connectionName]['creates'][] = $query;
// Unset the create from sql so we can have an array of everything else but creates
unset($sql[$key]);
}
}
// Store the creates and alters individually so we can merge them back together later
// We need the creates to happen first, then the alters
$connections[$connectionName]['creates'][] = $create;
$connections[$connectionName]['alters'] = array_merge($connections[$connectionName]['alters'], $sql);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment