Upgrade in package_check not working because of uninititzialed database


I’m in the process of fixing the upgrade-script of invoiceninja: https://github.com/YunoHost-Apps/invoiceninja_ynh/pull/4

The app is a laravel php app with a MySQL-database. The tables inside the database get created after logging in into the app. Before that the database is empty.

During the upgrade database-migrations happen. In a normal scenario (not when testing) these migrations work, because there are tables inside the database that can be changed.

However when running the upgrade with package_check, the database migrations fail, because the tables were never created (because nobody logged in into the app).

How does one solve this issue with package_check?

I could just skip the upgrade-test but I’d rather not.

I could probably somehow login into the app non-interactively, but since the app doesn’t support LDAP, I have no known credentials.

There is no artisan-task to create the tables if they do not exist.

Any other ideas?

Uh but then how does the real-life user log in the first time?

I meant only during testing. However I don’t know if I can separate what happens during testing and in real life.

Yes you can, there’s a var set during package check run which allows to test if you’re inside package_check … For example:

1 Like

Thanks for this infomation! I’ll try to implement this.