Skip to content

Migrate v2 models from MongoDB to MySQL #51

@regisb

Description

@regisb

This is an epic that covers many different issues.

We want to migrate the data for forum v2 from MongoDB to MySQL, a consistent data storage solution. Eventually, the v2 models will make use of the Django ORM. This transition must happen on a course-per-course basis: because we expect that large platforms will not want to migrate their courses in a single shot. Instead, they will first test the migration on a couple of courses, and then migrate all remaining courses.

Thus, the following sub-issues need to be completed: (details to be added later)

  • Implement a course feature toggle to query MySQL instead of MongoDB.
  • Implement a management command to migrate forum data for a single course.

Concurrently, the following models need to be migrated from MongoDB to MySQL:

  • User
  • Comment
  • Subscription
  • Notification
  • EditHistory
  • CommentThread
  • Activity

It is going to take a while before we are able to migrate all models from MongoDB to MySQL. For that reason, I suggest we take an approach similar to what we did for API view migrations, where we have a "model client" that queries MongoDB by default. Then, this client will query MySQL for more and more queries as we make progress. Here is a pseudo implementation:

# in forum.models.mongo
class ForumModelClient:

    def insert_user(external_id, username):
        ... # make calls to mongodb models

    def get_threads(course_id):
        ... # make calls to mongodb models

# in forum.models.mysql
from forum.models.mongo import ForumModelClient as MongoForumModelClient
class ForumModelClient(MongoForumModelClient):

    def insert_user(external_id, username):
        ... # make calls to mysql models

    # def get_threads(course_id): # this method is not migrated yet, and still uses mongodb storage

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions