[SOLVED] Migrations in modules? |
Hi guys.
Just trying to get a module migration working and seem to be having a bit of bother. I have done exactly what is described in the following article ... Modules_in_CodeIgniter_4 Now my question is, in the migration file, what namespace am I supposed to be using? And, they are supposed to just work right? no more configuring? Thanks
It will include all migrations it finds in Database/Migrations.
So by the User Guide you need to store your migrations under your namespace/Database/Migrations What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
Hi
Thanks for the response. My Directory layout is as follows ... App/ ... Standard/Auth/Database/Migrations/ System/ ... etc My migration file in the above migration dir is 20190427134005_add_auth_users.php and contains the following ... PHP Code: <?php namespace App\Database\Migrations; I then execute the following in the terminal ... PHP Code: php spark migrate:latest -all Which is supposed to run all the migrations, but doesnt, only the ones located in the main app directory. My autoload.php file in the main app config dir is changed as follows ... PHP Code: $psr4 = [ I dunno what I'm doing wrong.
Your namespace for standard should be in the root .
PHP Code: app When you use APPPATH or ROOTPATH you do not add the forward slash either. What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
What InsiteFX said is right, and just to point out the main difference is your path is missing the “/Auth” at the end of your namespace.
Hi again.
So I managed to get it do something, unfortunately it's still not working. When I run the migrate all command I get the following ... Code: The migration class "Standard\Auth\Database\Migrations\Migration_add_auth_users" could not be found. Think it has something to do with the namespace, because its finding the file, but cant find the class inside the file.
Sorted.
So my original question was ... Quote:Now my question is, in the migration file, what namespace am I supposed to be using? And the answer is ... PHP Code: <? namespace Standard\Auth\Database\Migrations |
Welcome Guest, Not a member yet? Register Sign In |