Commit d0ee6cd1 authored by gnat's avatar gnat

pre/post Up/Down methods

parent 589e2314
...@@ -325,20 +325,24 @@ class Doctrine_Migration ...@@ -325,20 +325,24 @@ class Doctrine_Migration
*/ */
protected function _doMigrate($direction) protected function _doMigrate($direction)
{ {
if ( ! method_exists($this, $direction)) { $method = 'pre'.$direction;
return; $this->$method();
}
if ( method_exists($this, $direction)) {
$this->$direction(); $this->$direction();
foreach ($this->_changes as $type => $changes) { foreach ($this->_changes as $type => $changes) {
$process = new Doctrine_Migration_Process(); if ( ! empty($changes)) {
$funcName = 'process' . Doctrine::classify($type); $funcName = 'process' . Doctrine::classify($type);
if ( ! empty($changes)) { $process = new Doctrine_Migration_Process();
$process->$funcName($changes); $process->$funcName($changes);
}
} }
} }
$method = 'post'.$direction;
$this->$method();
} }
/** /**
...@@ -580,4 +584,45 @@ class Doctrine_Migration ...@@ -580,4 +584,45 @@ class Doctrine_Migration
$this->_addChange('removed_indexes', $options); $this->_addChange('removed_indexes', $options);
} }
/**
* preUp
*
* @return void
*/
public function preUp()
{
return;
}
/**
* postUp
*
* @return void
*/
public function postUp()
{
return;
}
/**
* preDown
*
* @return void
*/
public function preDown()
{
return;
}
/**
* postDown
*
* @return void
*/
public function postDown()
{
return;
}
} }
\ No newline at end of file
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