Specify a strategy for representing inheritance/polymorphism in the database

Bug #1522309 reported by Aaron Wells
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Confirmed
Wishlist
Unassigned

Bug Description

Mahara has a few prominent awkward database structures, that can be considered examples of polymorphism and/or inheritance, in the data structures we store in the database.

Some of the awkward tables:

1. The parallel tables for each plugintype: artefact_installed, blocktype_installed, etc; artefact_cron, blocktype_cron, etc...

2. The multiple "owner" columns in the "view" table, which represent the different types of entities that can own a view (or collection, or artefact): view.owner, view.group, view.institution. This one has actually caused bugs so far, due to the need to make these columns nullable foreign keys, making it difficult to enforce the correct uniqueness constraint on some of the other columns.

3. If we ever get around to implementing artefact permissions, and/or multiple collections per page, we'll have a similar situation with the "view_access" table.

So far we've either copied Moodle or taken an ad-hoc "reinvent the wheel" approach to this issue. But there are actually a few known strategies for dealing with these situations, each of which has its own advantages and disadvantages. I think it would be good to summarize those into a table in the developer section of the wiki, so that we can make a more informed decision when implementing such tables in the future, or considering to refactor the existing tables.

Aaron Wells (u-aaronw)
description: updated
Revision history for this message
Aaron Wells (u-aaronw) wrote :

I've created a wiki page to try to work something out: https://wiki.mahara.org/wiki/Developer_Area/Database_design_strategies

Changed in mahara:
milestone: 16.04.0 → 16.10.0
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.0 → 16.10.1
Robert Lyon (robertl-9)
Changed in mahara:
milestone: 16.10.1 → 17.04.0
Changed in mahara:
milestone: 17.04.0 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.