Migrate Regress not limited to chosen group - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Migrate Regress not limited to chosen group (/showthread.php?tid=76075) |
Migrate Regress not limited to chosen group - ThomasB - 04-12-2020 The function $migrate->regress(-1,'content'); is rolling back the last migration regardless of its group. Example: PHP Code: $migrate = \Config\Services::migrations(); The above code will complete the migrations of the two groups correctly. If run a second time this will regress the 'users' migration and leave the 'content' migration alone. So the end result would be the last version of the 'content' up migration and the 'users' migration would be removed (down). Here is an example of one of the migration classes: PHP Code: <?php namespace App\Database\Migrations; Here are the entries in the "migrations" table of the main "default" database. Code: id version class group namespace time batch If anyone can spot what's wrong with this or explain why the behaviour I'm seeing is actually correct I would much appreciate it. Thanks |