![]() |
Duplicate migration files listed in status - 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: Duplicate migration files listed in status (/showthread.php?tid=88773) |
Duplicate migration files listed in status - murugappan - 11-04-2023 Hi, When i create a migration file and display the status using spark, the file is listed in duplicates (see screencap below). Due to this the rollback does not work. Any advice/help? https://prnt.sc/-n7v0Ynq1LAS RE: Duplicate migration files listed in status - kenjis - 11-04-2023 Try this: https://codeigniter4.github.io/CodeIgniter4/installation/upgrade_420.html#composer-json RE: Duplicate migration files listed in status - murugappan - 11-05-2023 @kenjis Thank you for the update. I removed the offending psr_4 definitions. The migration now works as expected. I added the ""App\\": "app", so that i could use the Create Class Extension to create classes. Does this mean that i have to create the classes manually with CI4? Also, could not figure why the migration function gets messed up with these definitions. Any explanation would be of great help. Thank you, so much. RE: Duplicate migration files listed in status - kenjis - 11-06-2023 What is "Create Class Extension"? I think the migration works, but just shows twice all migration files when you run migrate : status. It is because you add the App namespace twice to autoloader (CI4 autoloader and Composer autoloader). The issue will be resolved in v4.5.0. RE: Duplicate migration files listed in status - murugappan - 11-06-2023 (11-06-2023, 07:33 PM)kenjis Wrote: What is "Create Class Extension"? Hi, Thank you so much for the explanation. I realized the same when i accessed the code. Just needed confirmation. The duplicate works for spark:migrate but fails on rollback as it does not seem to know which to rollback. BTW, the "Create Class Extension" is a VS Code extension for PHP which provides a context menu to create a class using the psr-4 definition in composer.json. Works very well and saves a heap of time figuring out the namespace for each class we create. It actually creates a class script. and can also include strict-type checking. RE: Duplicate migration files listed in status - kenjis - 11-07-2023 @murugappan Thank you for the explanation. It is unfortunate that migration rollback does not work. Logically, if you remove App from Config/Autoload.php, and add App in composer.json, it works. But I'm not sure. |