diff --git a/src/Illuminate/Database/Console/Migrations/StatusCommand.php b/src/Illuminate/Database/Console/Migrations/StatusCommand.php
index 6cdea01faa75..6d38e350921f 100644
--- a/src/Illuminate/Database/Console/Migrations/StatusCommand.php
+++ b/src/Illuminate/Database/Console/Migrations/StatusCommand.php
@@ -56,9 +56,10 @@ public function handle()
}
$ran = $this->migrator->getRepository()->getRan();
+ $migrationsBatches = $this->migrator->getRepository()->getMigrationsBatches();
- if (count($migrations = $this->getStatusFor($ran)) > 0) {
- $this->table(['Ran?', 'Migration'], $migrations);
+ if (count($migrations = $this->getStatusFor($ran, $migrationsBatches)) > 0) {
+ $this->table(['Ran?', 'Migration', 'Batch'], $migrations);
} else {
$this->error('No migrations found');
}
@@ -68,16 +69,17 @@ public function handle()
* Get the status for the given ran migrations.
*
* @param array $ran
+ * @param array $migrationsBatches
* @return \Illuminate\Support\Collection
*/
- protected function getStatusFor(array $ran)
+ protected function getStatusFor(array $ran, array $migrationsBatches)
{
return Collection::make($this->getAllMigrationFiles())
- ->map(function ($migration) use ($ran) {
+ ->map(function ($migration) use ($ran, $migrationsBatches) {
$migrationName = $this->migrator->getMigrationName($migration);
return in_array($migrationName, $ran)
- ? ['Y', $migrationName]
+ ? ['Y', $migrationName, $migrationsBatches[$migrationName]]
: ['N', $migrationName];
});
}
diff --git a/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php b/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php
index b1685ffa3524..e438f8e6d764 100755
--- a/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php
+++ b/src/Illuminate/Database/Migrations/DatabaseMigrationRepository.php
@@ -53,6 +53,19 @@ public function getRan()
->pluck('migration')->all();
}
+ /**
+ * Get the ran migrations with batch numbers.
+ *
+ * @return array
+ */
+ public function getMigrationsBatches()
+ {
+ return $this->table()
+ ->orderBy('batch', 'asc')
+ ->orderBy('migration', 'asc')
+ ->pluck('batch', 'migration')->all();
+ }
+
/**
* Get list of migrations.
*
diff --git a/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php b/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php
index 60bc921f8931..88b942d100cb 100755
--- a/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php
+++ b/src/Illuminate/Database/Migrations/MigrationRepositoryInterface.php
@@ -11,6 +11,13 @@ interface MigrationRepositoryInterface
*/
public function getRan();
+ /**
+ * Get the ran migrations with batch numbers for a given package.
+ *
+ * @return array
+ */
+ public function getMigrationsBatches();
+
/**
* Get list of migrations.
*