App development: 'There are no commands defined in the "migrations" namespace.'

I moved my app development system from one maching running NC19 to a new one with NC25. Now I find myself trying to persuade NC to implement some DB changes.

There are two migration files, let’s call them 300 and 500. The first one (300) must have got executed at some point because I can see the table in the DB. The second one (500) did not for the intended table extensions were not carried out.

I made some editings to both files, including a change of the table name I use (table names starting with numbers seem not to be legit anymore). I updated info.xml and disabled and re-enabled the app but schema update was not triggered.

On the former system I enjoyed having more control over the DB update mechanism by using occ migrations:execute but on the current system occ throws this error message:

There are no commands defined in the "migrations" namespace.

I checked with sudo -u www occ list and must confirm complete absence of migration commands.

So, did the way for controlling DB migrations change and I could find it in the docs? Or is something missing in the installation so I cannot handle migrations?

I see that there were other namespace-related problems which really had to do with arguments and objects. It seems to me the absence of the command subsystem is a problem in itself.

Any hint appreciated

Hi, are you in debug mode?
https://docs.nextcloud.com/server/stable/developer_manual/getting_started/devenv.html#enabling-debug-mode

Without debug mode, done commands are just hidden and disabled. Thanks @szaimen for that hint.

Additionally, migrations are always called forward. There is no magic logic on how to undo them. So, once you are in version 500 there is no easy way to go back to 300 as far as i know.

There is a table oc_migrations in your database that hold a list of all successful migrations. You can undo the migrations manually and remove the appropriate rows from the migration table. Then, the migrations will be reapplied.

If i was wrong and there is some convince for devs installed that allows for replying migrations in some way, that would be nice to know and should be documented.

Christian

Aaah, got it, big thanks to you!

I shall look up where this is covered in the handbook, for now all docs links are broken.