laravel-mongodb
laravel-mongodb copied to clipboard
migration:rollback --step=2 does not work
- Laravel-mongodb Version: #.#.#
- lumen 8 and mongodb 5
- PHP Version: #.#.#
- 8.0.8
- Database Driver & Version:
- MongoDB extension version | 1.10.0 -- | --
Description:
php artisan migrate:rollback --step=2 or step=1 does not work, it gives 'Nothing to rollback'. But rollback without step works (php artisan migrate:rollback ). Reason is that \Illuminate\Database\Query\Grammars\Grammar::compileOrdersToArray receives array:2 [ "batch" => -1 "migration" => -1 ] and its code treats that array as array of arrays. This is happening with mongodb (github.com/jenssegers/laravel-mongodb) and not with mysql.
Also this returns empty array: \Illuminate\Database\Migrations\Migrator::getMigrationsForRollback that is calling: \Illuminate\Database\Migrations\DatabaseMigrationRepository::getMigrations:
public function getMigrations($steps)
{
$query = $this->table()->where('batch', '>=', '1');
return $query->orderBy('batch', 'desc')
->orderBy('migration', 'desc')
->take($steps)->get()->all();
}
Steps to reproduce
- create new table migrations
- run php artisan migrate
- run php artisan migrate:rollback --step=2
obs. make sure the user configured has drop permissions.
Expected behaviour
The migration should take place.
Actual behaviour
Nothing to rollback appears.
Logs:
Insert log.txt here (if necessary)
Any solution to this ?
Hi, I am having the same issue, the compileOrdersToArray is being used on multiple places, is there a way to replace this code with a custom function?