When trying to upgrade to 4.0.4 (ghcr.io/xibosignage/xibo-cms:release-4.0.4) the migration script failure prevents the starting of the application. It’s stuck on the maintenance screen.
Running database migrations
Phinx by CakePHP - https://phinx.org.
using config file /var/www/cms/phinx.php
using config parser php
using migration paths
- /var/www/cms/db/migrations
warning no environment specified, defaulting to: production
using adapter mysql
using database cms
ordering by creation time
== 20220330111440 ModulesTableVerFourMigration: migrating
== 20220330111440 ModulesTableVerFourMigration: migrated 0.1282s
== 20220512130000 AddTwitterConnectorMigration: migrating
== 20220512130000 AddTwitterConnectorMigration: migrated 0.0039s
== 20220512155400 RegionTypeMigration: migrating
== 20220512155400 RegionTypeMigration: migrated 0.0921s
== 20220520175400 DisplayMediaMigration: migrating
== 20220520175400 DisplayMediaMigration: migrated 0.0998s
== 20220903153600 RequiredfileDependencyMigration: migrating
== 20220903153600 RequiredfileDependencyMigration: migrated 0.0513s
== 20220915100902 AddFontsTableMigration: migrating
== 20220915100902 AddFontsTableMigration: migrated 0.1723s
== 20220928091249 PlayerSoftwareRefactorMigration: migrating
InvalidArgumentException: Not foreign key on columns 'mediaId' exist in /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/MysqlAdapter.php:931
Stack trace:
#0 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/PdoAdapter.php(916): Phinx\Db\Adapter\MysqlAdapter->getDropForeignKeyByColumnsInstructions()
#1 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/AdapterWrapper.php(477): Phinx\Db\Adapter\PdoAdapter->executeActions()
#2 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Db/Adapter/TimedOutputAdapter.php(420): Phinx\Db\Adapter\AdapterWrapper->executeActions()
#3 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Db/Plan/Plan.php(151): Phinx\Db\Adapter\TimedOutputAdapter->executeActions()
#4 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Db/Table.php(719): Phinx\Db\Plan\Plan->execute()
#5 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Db/Table.php(627): Phinx\Db\Table->executeActions()
#6 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Db/Table.php(686): Phinx\Db\Table->update()
#7 /var/www/cms/db/migrations/20220928091249_player_software_refactor_migration.php(118): Phinx\Db\Table->save()
#8 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Migration/Manager/Environment.php(108): PlayerSoftwareRefactorMigration->change()
#9 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Migration/Manager.php(388): Phinx\Migration\Manager\Environment->executeMigration()
#10 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Migration/Manager.php(359): Phinx\Migration\Manager->executeMigration()
#11 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Console/Command/Migrate.php(122): Phinx\Migration\Manager->migrate()
#12 /var/www/cms/vendor/symfony/console/Command/Command.php(298): Phinx\Console\Command\Migrate->execute()
#13 /var/www/cms/vendor/symfony/console/Application.php(1040): Symfony\Component\Console\Command\Command->run()
#14 /var/www/cms/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#15 /var/www/cms/vendor/robmorgan/phinx/src/Phinx/Console/PhinxApplication.php(70): Symfony\Component\Console\Application->doRun()
#16 /var/www/cms/vendor/symfony/console/Application.php(171): Phinx\Console\PhinxApplication->doRun()
#17 /var/www/cms/vendor/robmorgan/phinx/bin/phinx(28): Symfony\Component\Console\Application->run()
#18 /var/www/cms/vendor/bin/phinx(119): include('...')
#19 {main}
Importing ca-certs
cp: cannot stat '/var/www/cms/ca-certs/*.pem': No such file or directory
cp: cannot stat '/var/www/cms/ca-certs/*.crt': No such file or directory
Updating certificates in /etc/ssl/certs...
0 added, 0 removed; done.
Running hooks in /etc/ca-certificates/update.d...
done.
Setting up Quickchart
Configuring Maintenance
Removing web/install/index.php from production container
Configure PHP
Configure Apache
Starting cron
Starting webserver
This is a strange error - it is being raised when we try and drop the foreign key called mediaId on the playersoftware table. I am not sure how you have a database without a foreign key on that table.
Is this the first time you have run the upgrade/restarted the containers?
Its going to be difficult to fix because there are other parts of that migration which can’t be rerun. The best thing to do would be restore the DB from backup and then manually add the mediaId foreign key to the database prior to upgrading it.
Is this the first time you have run the upgrade/restarted the containers?
This Xibo instance is running since 2.0.0(back in 2019) and we haven’t any problems upgrading it until 4.0.x
Its going to be difficult to fix because there are other parts of that migration which can’t be rerun. The best thing to do would be restore the DB from backup and then manually add the mediaId foreign key to the database prior to upgrading it.
We currently still run 3.3.8 and can copy this state (files) prior “trying” again the upgrade to 4.0.x.
So there is no need to “fix” a broken 4.0.x instance but to get the upgrade to 4.0.x working
But we do not hurry to upgrade, given the amount of bugs 4.0.x still has. But it would be great to be able to upgrade one day as well