Skip to content

Commit

Permalink
fix: disable MySQL backend in forum on upgrade
Browse files Browse the repository at this point in the history
In Sumac, it was decided that we would not automatically migrating data
from mongodb to mysql. Instead, we encourage users to do so manually, in
the tutor-forum README.
  • Loading branch information
regisb committed Nov 19, 2024
1 parent b134b90 commit a4396f9
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Feature] With the new forum v2 application, users have a choice to use MongoDB or MySQL as a storage backend, course per course. New users will automatically start using MySQL, while existing users will be responsible for migrating their data themselves (before the Teak release). Upgrade instructions are available here: https://github.com/overhangio/tutor-forum/#installation. (by @regisb)
16 changes: 16 additions & 0 deletions tutor/commands/upgrade/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,22 @@ def upgrade_from_nutmeg(context: click.Context, config: Config) -> None:
)


def upgrade_from_redwood(context: click.Context, config: Config) -> None:
# Prevent switching to the MySQL storage backend in forum v2
if plugins.is_loaded("forum"):
fmt.echo_alert(
"Your platform is going to be configured to store forum data in MongoDB. "
"You are STRONGLY ENCOURAGED to migrate your forum data to MySQL as soon as possible. "
"To do so, refer to the tutor-forum plugin documentation: https://github.com/overhangio/tutor-forum/#installation"
)
context.obj.job_runner(config).run_task(
"lms",
"""
(./manage.py lms waffle_flag --list | grep forum_v2.enable_mysql_backend) || ./manage.py lms waffle_flag --create --deactivate forum_v2.enable_mysql_backend
""",
)


def get_mongo_upgrade_parameters(
docker_version: str, compatibility_version: str
) -> tuple[int, dict[str, int | str]]:
Expand Down
1 change: 1 addition & 0 deletions tutor/commands/upgrade/compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def upgrade_from(context: click.Context, from_release: str) -> None:
running_release = "redwood"

if running_release == "redwood":
common_upgrade.upgrade_from_redwood(context, config)
running_release = "sumac"


Expand Down
1 change: 1 addition & 0 deletions tutor/commands/upgrade/k8s.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ def upgrade_from(context: click.Context, from_release: str) -> None:
running_release = "redwood"

if running_release == "redwood":
common_upgrade.upgrade_from_redwood(context, config)
running_release = "sumac"


Expand Down

0 comments on commit a4396f9

Please sign in to comment.