At present the table names and the way the data for course and related content is stored is not very scalable. The reason for this is that earlier when we started building the application there was not enough clarity about the difference between the course and content. There was an understanding that course can be any kind of content (simple text, a document, a video, a text with embedded files). With the latest mockups this relation has become more clear which calls for some code and DB re-factoring to make sure that the design is more scalable and data is as closely modelled with the requirement.
Seeing the current mocks this is how the DB design and the corresponding model design should be:
No change in structure except for adding a user_id column
The idea behind the versioning was that a course can simply be some text (with embedded documents). With this thinking it was easier to maintain versions of text (by copying a version to separate table). However now the course is collection of contents of different kind, and this information is stored by associating the course with different contents in an association table (course_contents). We anyway do not store the versions when we implemented the course creation (based on mockups), so no point in keeping the content_versions table. This table just adds more confusion.
1. Content model to be renamed to Course.
2. Modify the course_documents table and rename it to course_contents and update it with the structure mentioned above.
3. Add new table “Contents”.