No announcement yet.

Cross database foreign keys

  • Filter
  • Time
  • Show
Clear All
new posts

  • Cross database foreign keys

    With MariaDB 10.0 if I import a table which has a foriegn key constraint with a column in another database then the constraint does not appear in the table definition. If I try and create it from the table defintion dialogue it allows me to enter the definition (i.e. other database) but if I then click on OK and reopen the dialogue then the data entered no longer displays with the "Referenced Schema", "Referenced Table" and "Referenced Fields" all showing as blank.

    Has anyone managed to get this working?

  • #2
    A bit more investigation. I've used "Dump SQL file" on the 'games' table in 'fote_dev' to look at its structure which contains:

    CONSTRAINT `game_scenario_id_fk` FOREIGN KEY (`scenario`) REFERENCES `fote_reference`.`scenarios` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
    CONSTRAINT `game_umpire_id_fk` FOREIGN KEY (`umpire`) REFERENCES `players` (`id`)

    So, that's correct and shows the cross database constraint. However, if I use the "Reverse database to model" option and display the foreign keys I see the attachment. No sign of the cross database contraint.


    • #3
      Hi Scopa,

      Did you import both parent and child tables to the model? If no, please try to import both tables using the Import from Database feature. (Create a new model and choose Tools > Import from Database from the model's menu.)

      If you still enounter the same problem, could you please provide us the following information for investigation? You can send the information to our support center -

      1. The structure of both parent and child tables. (Right-click your table and choose Dump SQL file > Structure Only)
      2. Screenshots showing detailed steps to reproduce the problem.
      3. The model file. (Right-click the model file and choose Open Containing Folder)


      • #4
        Hello and thanks for you reply. You've given me all the information I need to get this working (import both databases into one model)