Migrate to a certain file |
Let's say I have 10 migrations files in the folder "App/Database/Migrations and everyone is migrated. Now I like to rollback to the migration nr 7. How can I do that from a controller in CI4?
In CI3 I ran Code: $this->migration->version($timestamp); I have problem finding any function that rollbacks migrations the way I want: Method regress() seems to work with batches and groups. I have group 'default' and batch '1' in all my files, so that's not for me. Method force() might work, but how do I pass in the namespace as the second argument? force('App\Database\Migrations\Add_something,) The following ugly script throws the error "Migration file not found": PHP Code: <?php namespace App\Controllers; "Migrations (to keep order, only migrate one step up/down at a time. I will restrict links someday): C:\xampp\htdocs\ci4\app\Database\Migrations\20100101000000_add_dummy.phpMigrate this file C:\xampp\htdocs\ci4\app\Database\Migrations\20100101000002_add_hobby.phpMigrate this file C:\xampp\htdocs\ci4\app\Database\Migrations\20100101000003_add_human.phpMigrate this file LATEST C:\xampp\htdocs\ci4\app\Database\Migrations\20100101000004_add_another_human.phpMigrate this file"
I've also interested of this question and asked it here (didn't notice your post before).
In CI3 it was very helpful. And it is not yet clear how to do this in CI4. If this is not possible, then how to use the down() methods in migration files? The documentation only describes an example of how to switch to the latest migration, but no examples of how to switch between different versions. |
Welcome Guest, Not a member yet? Register Sign In |