Skip to content

Commit d91d6b1

Browse files
author
Gravitano
committed
fix array reverse. ref: pingpong-labs#170, fix pingpong-labs#171
1 parent 5a42e25 commit d91d6b1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

Migrations/Migrator.php

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ public function getPath()
4646
/**
4747
* Get migration files.
4848
*
49+
* @param boolean $reverse
4950
* @return array
5051
*/
51-
public function getMigrations()
52+
public function getMigrations($reverse = false)
5253
{
5354
$files = $this->laravel['files']->glob($this->getPath().'/*_*.php');
5455

@@ -69,6 +70,10 @@ public function getMigrations()
6970
// the order they were actually created by the application developers.
7071
sort($files);
7172

73+
if ($reverse) {
74+
return array_reverse($files);
75+
}
76+
7277
return $files;
7378
}
7479

@@ -79,7 +84,7 @@ public function getMigrations()
7984
*/
8085
public function rollback()
8186
{
82-
$migrations = $this->getLast($this->getMigrations());
87+
$migrations = $this->getLast($this->getMigrations(true));
8388

8489
$this->requireFiles($migrations);
8590

@@ -107,7 +112,7 @@ public function rollback()
107112
*/
108113
public function reset()
109114
{
110-
$migrations = $this->getMigrations();
115+
$migrations = $this->getMigrations(true);
111116

112117
$this->requireFiles($migrations);
113118

0 commit comments

Comments
 (0)