Welcome Guest, Not a member yet? Register   Sign In
Duplicate migration files listed in status
#1

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
Reply
#2

Try this: https://codeigniter4.github.io/CodeIgnit...poser-json
Reply
#3

(This post was last modified: 11-06-2023, 03:05 AM by murugappan.)

@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.
Reply
#4

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.
Reply
#5

(This post was last modified: 11-06-2023, 07:56 PM by murugappan.)

(11-06-2023, 07:33 PM)kenjis Wrote: 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.

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.
Reply
#6

@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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB