•  
      request #37198 Add FOREIGN KEY to tables
    Infos
    #37198
    Guilhem Bonnefille (CS) (gbonnefille)
    2024-03-21 08:51
    2024-03-07 15:18
    38809
    Details
    Add FOREIGN KEY to tables

    Currently, the SQL schema does not declare the FOREIGN KEYs.

    Declaring them can enforce some relations, avoiding many programming issues (at runtime). But this also offers the ability for many tools to display a nice reverse engineered model.

    The FOREIGN KEY is supported by MySQL: https://dev.mysql.com/doc/refman/8.0/en/create-table-foreign-keys.html

    If such feature brings some performance issues, the administrators are still able to disable the checks: https://dev.mysql.com/doc/refman/8.0/en/create-table-foreign-keys.html#foreign-key-checks

    Other
    15.4
    Empty
    • [ ] enhancement
    • [ ] internal improvement
    Empty
    Stage
    Empty
    New
    Empty
    Attachments
    References
    References list is empty

    Follow-ups

    User avatar

    Artifact deletion is all but complete at this stage. It's been half implemented by a contributor years ago and they didn't bother to continue.

    IMHO, I would advise to have the whole process async (but be careful, some platforms are not async) and to accept that there is a small delay between the deletion request and the actual deletion.

    User avatar

    Looking at the artifact deletion, I understand that the artifact entry is deleted synchronously, while the other parts are deleted asynchronously. Thus, this is a foreign key violation. To deal with this model, we have to introduce a deleted column, mark the artifact deleted synchronously and delete the whole artifact asynchronously. And then, we have to adjust all artifact selection in order to consider the deleted column. Huge change. A simplification would be to add a tracker_artifact_not_deleted view.