Trouble getting DB Migration to run - app's migration versions not "regeistered"?

I’m trying to get the PhoneSync / OCSMS app working in nextcloud 23. I cannot figure out how to get the DB migration script to run, hence there are no tables in the DB being created that the app needs to function.

If I run
sudo -u www-data php8.0 /[path to nc]/occ -vvv migrations:execute ocsms 020109Date20201216203338

It returns with
Version 020109Date20201216203338 is unknown.

If I run
occ migrations:status ocsms

It shows
>> App: ocsms
>> Version Table Name: oc_migrations
>> Migrations Namespace: OCA\Ocsms\Migration
>> Migrations Directory: /[correct path to nextcloud]/apps/ocsms/lib/Migration
>> Previous Version: Already at first migration step
>> Current Version: 0
>> Next Version: Already at latest migration step
>> Latest Version:
>> Executed Migrations: 0
>> Executed Unavailable Migrations: 0
>> Available Migrations: 0
>> New Migrations: 0
>> Pending Migrations: None

Why is it not picking up any of the migration files in the app directory? Aka Current Version 0 and executed migrations 0

How do I get it to recognize the app’s migration files? The ocsms app came with one [nc path]/apps/ocsms/lib/migration/Version020109Date20201216203338.php

I also tried copying that file to a new higher version number, disabling and re-enabling the app in the admin web interface, etc. Nothing seems to work.

Also looking at the output of migrations:status, I see it’s using the oc_migrations table in the DB. If I query that table from the sql console, there’s no entry there for ocsms.

How do I get ocsms’ migration version to be “registered” with nextcloud so it shows up in that table? Is this something new in NC23? I don’t seem to see anything about this in the developer manual in the new app tutorial.

do you use an authorative composer autoloader? Then see

otherwise double check your namespaces and class names. do you have any lower/upper case mismatches?

To complement @ChristophWurst 's answer: If you are using an authoritative composer autoloader, then you should run “composer dump-autoload” from within the app’s directory to fix the issue.

1 Like