Commit e2b7d65c authored by Anahkiasen's avatar Anahkiasen

Added migrate:rebuild command to clean and reconstruct the database

Signed-off-by: 's avatarAnahkiasen <ehtnam6@gmail.com>
parent 205cc486
......@@ -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.
*
......
......@@ -70,3 +70,7 @@ When you roll back a migration, Laravel rolls back the entire migration "operati
**Roll back all migrations that have ever run:**
php artisan migrate:reset
**Roll back everything and run all migrations again:**
php artisan migrate:rebuild
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