Virtual foreign keys broken after migration to 2.4.1


I upgraded from 2.2.1 to 2.4.1. For some reason, virtual foreign keys were not migrated correctly:

  • When I go to Schema, and select a table that had a virtual relationship before the upgrade, I don’t see the relationship anymore
  • When I do a GET to _table/table_name with related=…, I don’t get the related records anymore
  • Re-adding the virtual relationship solves the problem, but it is a lot of work in my case.
  • The new table db_virtual_relationship does contain records for the virtual foreign keys after the migration, but as stated, they don’t work.

During the migration, the migration script ran without errors.

Edit: while re-adding one of the virtual relationships, I bumped into the next problem. For one particular virtual foreign key, only half of the relationship is added. E.g. adding a “belongs to” relationship normally results in a “has many” relationship for the other table. But not in this particular case. Manually adding the other half breaks the API, a GET with related=… then gives the error below.

  "error": {
    "context": null,
    "message": "Cannot read property 'length' of undefined",
    "code": 500,
    "trace": [
      "0 /opt/bitnami/apps/dreamfactory/htdocs/vendor/dreamfactory/df-core/src/Events/InterProcessApiEvent.php(39): DreamFactory\\Core\\Events\\InterProcessApiEvent->handleScript(