Added migrate:rebuild command to clean and reconstruct the database
Signed-off-by: Anahkiasen <ehtnam6@gmail.com>
This commit is contained in:
parent
205cc4869d
commit
e2b7d65c18
|
@ -139,6 +139,25 @@ public function reset($arguments = array())
|
|||
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.
|
||||
*
|
||||
|
|
|
@ -70,3 +70,7 @@ ## Rolling Back
|
|||
**Roll back all migrations that have ever run:**
|
||||
|
||||
php artisan migrate:reset
|
||||
|
||||
**Roll back everything and run all migrations again:**
|
||||
|
||||
php artisan migrate:rebuild
|
||||
|
|
Loading…
Reference in New Issue