First let me say that I am using MySQL (not transactional) and that this cannot be changed. In addition, I have simplified the tables here for brevity and clarity.
In this example, the βLessonβ consists of internal attributes and external attributes with its own βReadingβ attributes. Readings has its own key-dependent attributes and three different external attributes (reading sources).
I want to avoid the polymorphic association described here, but I cannot wrap it. In this example, the "sourceId" in the "Read" table will contain the identifier from one of the three tables "ExternalURL", "InternalURL" and "Book". In addition, the "polytable" field will contain the name of the table from which the aforementioned "id" came.
Can someone take a moment to explain how to enable this supporting RI, or is it possible that it should be left in the interest of efficiency?
Thank you for your time and attention,
Tim
-------------
| ExternalURL |
-------------
| id |
| badlink |
| url |
| |
| |
-------------
|
|
|
/ \
------------ ------------- -------------
| Lesson |-------<| Reading |>-------| InternalURL |
------------ ------------- -------------
| id | | id | | id |
| label | | lessonId | | url |
| summary | | sourceId | | |
| lessonOrder| | polytable | | |
| active | | label | | |
------------ ------------- -------------
\ /
|
|
------------
| Book |
------------
| id |
| label |
| summary |
| lessonOrder|
| active |
------------
source
share