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



Third Party seeds? - blaasvaer - 09-10-2020

How would I create and run a seed from a Third Party module?

I can seem to only run seeds from App\Database\Seeds ... can I 'somehow' point:

Code:
php spark db:seed DefaultUser -path \App\ThirdParty\Auth

Would be nice ...


RE: Third Party seeds? - InsiteFX - 09-11-2020

I know that you can run them from a module but I don't think you can run them from
the ThirdParty folder because there is no database folder.


RE: Third Party seeds? - eternity6 - 03-24-2021

You can do it, but official documentation is not write well.

https://codeigniter4.github.io/userguide/general/modules.html#seeds

For call a Seed from an external module in CLI asuming that name space of module is: \App\ThirdParty\

Seed must have a namespace like this: \App\ThirdParty\Database\Seeds

Assuming that the class name of this Seed is Auth

the right way to write command is:


Code:
php spark db:seed [color=#333333][size=small][font=Tahoma, Verdana, Arial, sans-serif][b][color=#333333][size=small][size=small][font=Tahoma, Verdana, Arial, sans-serif]\App\ThirdParty\[/font][/size][/size][/color]Database\Seeds\Auth[/b][/font][/size][/color]