Migration script failure prevents upgrade from 3.3.8 to 4.0.4

CMS Version

  • ghcr.io/xibosignage/xibo-cms:release-3.3.8
  • ghcr.io/xibosignage/xibo-xmr:0.11
  • docker.io/mysql:8.0.35

Installation Method

Docker 24.0.7

Operating System

Debian 12

Issue

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

Provide screenshots where possible!

image

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 :wink:

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 :thinking:

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 :+1:

Some more details to help debug the problem:

mysql> SHOW COLUMNS FROM player_software;
+-------------------+-------------+------+-----+---------+----------------+
| Field             | Type        | Null | Key | Default | Extra          |
+-------------------+-------------+------+-----+---------+----------------+
| versionId         | int         | NO   | PRI | NULL    | auto_increment |
| player_type       | varchar(15) | YES  |     | NULL    |                |
| player_version    | varchar(15) | YES  |     | NULL    |                |
| player_code       | int         | YES  |     | NULL    |                |
| playerShowVersion | varchar(50) | NO   |     | NULL    |                |
| mediaId           | int         | YES  | MUL | NULL    |                |
+-------------------+-------------+------+-----+---------+----------------+
6 rows in set (0.00 sec)

mysql> SHOW INDEXES IN player_software;
+-----------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| Table           | Non_unique | Key_name | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment | Visible | Expression |
+-----------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
| player_software |          0 | PRIMARY  |            1 | versionId   | A         |          16 |     NULL |   NULL |      | BTREE      |         |               | YES     | NULL       |
| player_software |          1 | mediaId  |            1 | mediaId     | A         |          16 |     NULL |   NULL | YES  | BTREE      |         |               | YES     | NULL       |
+-----------------+------------+----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+---------+------------+
2 rows in set (0.01 sec)

mysql> SHOW CREATE TABLE player_software;
+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table           | Create Table                                                                                                                                                                                                                                                                                                                                                                                      |
+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| player_software | CREATE TABLE `player_software` (
  `versionId` int NOT NULL AUTO_INCREMENT,
  `player_type` varchar(15) DEFAULT NULL,
  `player_version` varchar(15) DEFAULT NULL,
  `player_code` int DEFAULT NULL,
  `playerShowVersion` varchar(50) NOT NULL,
  `mediaId` int DEFAULT NULL,
  PRIMARY KEY (`versionId`),
  KEY `mediaId` (`mediaId`)
) ENGINE=InnoDB AUTO_INCREMENT=56 DEFAULT CHARSET=utf8mb3 |
+-----------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)

and the table constraints …

mysql> select * from information_schema.table_constraints;
+--------------------+--------------------+---------------------------------------------+--------------------+------------------------------------------------------+-----------------+----------+
| CONSTRAINT_CATALOG | CONSTRAINT_SCHEMA  | CONSTRAINT_NAME                             | TABLE_SCHEMA       | TABLE_NAME                                           | CONSTRAINT_TYPE | ENFORCED |
+--------------------+--------------------+---------------------------------------------+--------------------+------------------------------------------------------+-----------------+----------+
| def                | cms                | PRIMARY                                     | cms                | widgetoption                                         | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | widgethistory                                        | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | widget                                               | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | usertype                                             | PRIMARY KEY     | YES      |
| def                | cms                | userId                                      | cms                | useroption                                           | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | user                                                 | PRIMARY KEY     | YES      |
| def                | cms                | user_ibfk_1                                 | cms                | user                                                 | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | transition                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | task                                                 | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | tag                                                  | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | status                                               | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | stat                                                 | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | setting                                              | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | session                                              | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | schedulereminder                                     | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | scheduleexclusions                                   | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | schedule                                             | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | saved_report                                         | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | resolution                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | requiredfile                                         | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | reportschedule                                       | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | regionoption                                         | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | region                                               | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | purge_list                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | playlist                                             | PRIMARY KEY     | YES      |
| def                | cms                | playlist_ibfk_1                             | cms                | playlist                                             | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | player_software                                      | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | player_faults                                        | PRIMARY KEY     | YES      |
| def                | cms                | player_faults_ibfk_1                        | cms                | player_faults                                        | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | phinxlog                                             | PRIMARY KEY     | YES      |
| def                | cms                | entity                                      | cms                | permissionentity                                     | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | permissionentity                                     | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | permission                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | oauth_scopes                                         | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | oauth_scope_routes                                   | PRIMARY KEY     | YES      |
| def                | cms                | clientId                                    | cms                | oauth_lkclientuser                                   | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | oauth_lkclientuser                                   | PRIMARY KEY     | YES      |
| def                | cms                | oauth_lkclientuser_ibfk_1                   | cms                | oauth_lkclientuser                                   | FOREIGN KEY     | YES      |
| def                | cms                | oauth_lkclientuser_ibfk_2                   | cms                | oauth_lkclientuser                                   | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | oauth_clients                                        | PRIMARY KEY     | YES      |
| def                | cms                | oauth_client_scopes_clientId_scopeId_uindex | cms                | oauth_client_scopes                                  | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | oauth_client_scopes                                  | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | oauth_client_redirect_uris                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | notification                                         | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | module                                               | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | menu_product_options                                 | PRIMARY KEY     | YES      |
| def                | cms                | menu_product_options_ibfk_1                 | cms                | menu_product_options                                 | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | menu_product                                         | PRIMARY KEY     | YES      |
| def                | cms                | menu_product_ibfk_1                         | cms                | menu_product                                         | FOREIGN KEY     | YES      |
| def                | cms                | menu_product_ibfk_2                         | cms                | menu_product                                         | FOREIGN KEY     | YES      |
| def                | cms                | menu_product_ibfk_3                         | cms                | menu_product                                         | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | menu_category                                        | PRIMARY KEY     | YES      |
| def                | cms                | menu_category_ibfk_1                        | cms                | menu_category                                        | FOREIGN KEY     | YES      |
| def                | cms                | menu_category_ibfk_2                        | cms                | menu_category                                        | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | menu_board                                           | PRIMARY KEY     | YES      |
| def                | cms                | menu_board_ibfk_1                           | cms                | menu_board                                           | FOREIGN KEY     | YES      |
| def                | cms                | menu_board_ibfk_2                           | cms                | menu_board                                           | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | media                                                | PRIMARY KEY     | YES      |
| def                | cms                | media_ibfk_1                                | cms                | media                                                | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | log                                                  | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | lkwidgetmedia                                        | PRIMARY KEY     | YES      |
| def                | cms                | lkwidgetaudio_widgetId_mediaId_uindex       | cms                | lkwidgetaudio                                        | UNIQUE          | YES      |
| def                | cms                | GroupID_2                                   | cms                | lkusergroup                                          | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lkusergroup                                          | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | lktagplaylist                                        | PRIMARY KEY     | YES      |
| def                | cms                | tagId                                       | cms                | lktagplaylist                                        | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lktagmedia                                           | PRIMARY KEY     | YES      |
| def                | cms                | tagId                                       | cms                | lktagmedia                                           | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lktaglayout                                          | PRIMARY KEY     | YES      |
| def                | cms                | tagId                                       | cms                | lktaglayout                                          | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lktagdisplaygroup                                    | PRIMARY KEY     | YES      |
| def                | cms                | tagId                                       | cms                | lktagdisplaygroup                                    | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lktagcampaign                                        | PRIMARY KEY     | YES      |
| def                | cms                | tagId                                       | cms                | lktagcampaign                                        | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lkscheduledisplaygroup                               | PRIMARY KEY     | YES      |
| def                | cms                | childId                                     | cms                | lkplaylistplaylist                                   | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lkplaylistplaylist                                   | PRIMARY KEY     | YES      |
| def                | cms                | notificationId                              | cms                | lknotificationuser                                   | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lknotificationuser                                   | PRIMARY KEY     | YES      |
| def                | cms                | notificationId                              | cms                | lknotificationgroup                                  | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lknotificationgroup                                  | PRIMARY KEY     | YES      |
| def                | cms                | notificationId                              | cms                | lknotificationdg                                     | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lknotificationdg                                     | PRIMARY KEY     | YES      |
| def                | cms                | mediaid                                     | cms                | lkmediadisplaygroup                                  | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lkmediadisplaygroup                                  | PRIMARY KEY     | YES      |
| def                | cms                | layoutId                                    | cms                | lklayoutdisplaygroup                                 | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lklayoutdisplaygroup                                 | PRIMARY KEY     | YES      |
| def                | cms                | DisplayGroupDisplayId                       | cms                | lkdisplaydg                                          | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lkdisplaydg                                          | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | lkcommanddisplayprofile                              | PRIMARY KEY     | YES      |
| def                | cms                | CampaignID_2                                | cms                | lkcampaignlayout                                     | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | lkcampaignlayout                                     | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | lkcampaigndisplaygroup                               | PRIMARY KEY     | YES      |
| def                | cms                | lkcampaigndisplaygroup_ibfk_1               | cms                | lkcampaigndisplaygroup                               | FOREIGN KEY     | YES      |
| def                | cms                | lkcampaigndisplaygroup_ibfk_2               | cms                | lkcampaigndisplaygroup                               | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | layouthistory                                        | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | layout                                               | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | help                                                 | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | group                                                | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | folder                                               | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | displayprofile                                       | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | displaygroup                                         | PRIMARY KEY     | YES      |
| def                | cms                | displaygroup_ibfk_1                         | cms                | displaygroup                                         | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | displayevent                                         | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | display_types                                        | PRIMARY KEY     | YES      |
| def                | cms                | license                                     | cms                | display                                              | UNIQUE          | YES      |
| def                | cms                | PRIMARY                                     | cms                | display                                              | PRIMARY KEY     | YES      |
| def                | cms                | display_ibfk_1                              | cms                | display                                              | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | daypart                                              | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | datasetrss                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | datasetcolumn                                        | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_63                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_62                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_61                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_60                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_56                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_55                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_53                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_52                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_50                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_49                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_47                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_40                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_34                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_33                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_31                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_30                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_29                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_28                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_27                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_26                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_25                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_24                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_22                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_20                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_19                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_17                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_15                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_14                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_13                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_11                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset                                              | PRIMARY KEY     | YES      |
| def                | cms                | dataset_ibfk_1                              | cms                | dataset                                              | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | connectors                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | command                                              | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | campaign                                             | PRIMARY KEY     | YES      |
| def                | cms                | campaign_ibfk_1                             | cms                | campaign                                             | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | bandwidthtype                                        | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | bandwidth                                            | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | auditlog                                             | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | action                                               | PRIMARY KEY     | YES      |
| def                | cms                | action_ibfk_1                               | cms                | action                                               | FOREIGN KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_46                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_9                                            | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_39                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_12                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_16                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_48                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_18                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_10                                           | PRIMARY KEY     | YES      |
| def                | cms                | PRIMARY                                     | cms                | dataset_65                                           | PRIMARY KEY     | YES      |
+--------------------+--------------------+---------------------------------------------+--------------------+------------------------------------------------------+-----------------+----------+

Thanks for the details - the error is right, for some reason you don’t have a foreign key on that column, just a key without the constraint.

The table is added originally as a foreign key, but we should be able to protect against one not being there in the migration.

I’ve added an improvement for it here:

1 Like

Hi, have the same porblem, did you solve it? Thanks Mark

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.