diff options
Diffstat (limited to 'lib/migrations/Migrator.php')
| -rw-r--r-- | lib/migrations/Migrator.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/migrations/Migrator.php b/lib/migrations/Migrator.php index 07caa90..50c8f3f 100644 --- a/lib/migrations/Migrator.php +++ b/lib/migrations/Migrator.php @@ -470,6 +470,25 @@ class Migrator } /** + * Returns the number of available, but not yet applied migrations. + * + * @return int migration count + */ + public function pendingMigrations() + { + $pending = 0; + + foreach (array_keys($this->migrationClasses()) as $version) { + list($branch, $version) = $this->migrationBranchAndVersion($version); + if ($this->schema_version->get($branch) < $version) { + ++$pending; + } + } + + return $pending; + } + + /** * Overridable method used to return a textual representation of what's going * on in me. You can use me as you would use printf. * |
