Added migrate:rebuild command to clean and reconstruct the database

Signed-off-by: Anahkiasen <ehtnam6@gmail.com>
This commit is contained in:
Anahkiasen
2012-10-26 19:45:32 +01:00
parent 205cc4869d
commit e2b7d65c18
2 changed files with 25 additions and 2 deletions

View File

@@ -139,6 +139,25 @@ class Migrator extends Task {
while ($this->rollback()) {};
}
/**
* Reset the database to pristine state and run all migrations
*
* @param array $arguments
* @return void
*/
public function rebuild()
{
// Clean the database
$this->reset();
echo PHP_EOL;
// Re-run all migrations
$this->migrate();
echo 'The database was successfully rebuilt'.PHP_EOL;
}
/**
* Install the database tables used by the migration system.
*