CodeIgniter Forums
Third Party Migrations - 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: Third Party Migrations (/showthread.php?tid=73106)

Pages: 1 2


RE: Third Party Migrations - MGatner - 03-22-2019

One more thing to note about using the Autoloader instead of a flat array read from app/Config/Autoload.php is that the Autoloader supports multiple paths for a single namespace (like Composer) but the array in the config file does not.


RE: Third Party Migrations - kilishan - 03-22-2019

That's the way it should be done. The migrations stuff was done way before Composer was integrated into the file location process and I just didn't think about that, honestly. So Thanks!

I did make a comment on the PR that it might be better to user the FileLocator class instead of the autoloader directly, though.


RE: Third Party Migrations - MGatner - 03-26-2019

To close the loop on anyone reading this, third party migrations are now supported! If a package includes an appropriately namespaced migration then after it is installed you can run `php spark migrate:latest -all` to run the migrations without any other configuration. If you have security concerns (well you should really address those before installing) you can run individual namespaces with -n.
I have been adding the first command to composer.json in post-update-cmd so migrations are applied automatically on install/update.


RE: Third Party Migrations - blaasvaer - 09-10-2020

I get:



Code:
Command "migrate:latest" not found.




When trying to migrate Auth



I added this to the Autoload.php:



Code:
    public $psr4 = [
        'Config'          => APPPATH . 'Config',
        'Modules'        => APPPATH . 'Modules',
        'Auth'            => APPPATH . 'ThirdParty/Auth',
    ];


Any idea what else I missed to do?

OK, dropped the 'migrations' table and ran:

Code:
php spark migrate -all

removing the ':latest' part ...