Command to list migrations and migrate to a previous version using tutor

I used the following command on my openedx app
tutor local exec lms ./manage.py lms migrate

however I would like to revert the migration, what is the exact command I must use to list migrations and to revert to a specific one?

Did you try using the normal Django commands to list the migrations?
To be specific, try doing this: tutor local exec lms ./manage.py lms showmigrations

This would show the list of migrations.

@zameel7, thanks for the reply, yes I tried this however it is failing with the same error due to which I wanted to revert the migration. I encountered this error after using the migrations command, the error is unrelated to my changes. however, it is still getting included in migrations somehow, I tried to delete containers and build images fresh but the lms_worker & cms_worker containers also keep restarting due to the same error - it is related to “SAML_CONFIG”. this has been a blocker for 2 weeks. Have you encountered similar issues? Can someone help me unblock myself?

Hello @pravallika_n,

Please provide your error stack trace here so that community can help you.

@jramnai here’s the error stack:

$ docker logs tutor_local_cms-worker_1
  from djangosaml2idp import urls
  File "/openedx/venv/lib/python3.8/site-packages/djangosaml2idp/urls.py", line 3, in <module>
    from . import views
  File "/openedx/venv/lib/python3.8/site-packages/djangosaml2idp/views.py", line 35, in <module>
    raise ImproperlyConfigured("SAML_IDP_SPCONFIG not defined in settings.")
django.core.exceptions.ImproperlyConfigured: SAML_IDP_SPCONFIG not defined in settings.
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/djangosaml2idp/views.py", line 33, in <module>
    idp_sp_config = settings.SAML_IDP_SPCONFIG
  File "/openedx/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 83, in __getattr__
    val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'SAML_IDP_SPCONFIG'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/openedx/venv/bin/celery", line 8, in <module>
    sys.exit(main())
  File "/openedx/venv/lib/python3.8/site-packages/celery/__main__.py", line 16, in main
    _main()
  File "/openedx/venv/lib/python3.8/site-packages/celery/bin/celery.py", line 322, in main
    cmd.execute_from_commandline(argv)
  File "/openedx/venv/lib/python3.8/site-packages/celery/bin/celery.py", line 499, in execute_from_commandline
    super(CeleryCommand, self).execute_from_commandline(argv)))
  File "/openedx/venv/lib/python3.8/site-packages/celery/bin/base.py", line 305, in execute_from_commandline
    return self.handle_argv(self.prog_name, argv[1:])
  File "/openedx/venv/lib/python3.8/site-packages/celery/bin/celery.py", line 491, in handle_argv
    return self.execute(command, argv)
  File "/openedx/venv/lib/python3.8/site-packages/celery/bin/celery.py", line 415, in execute
    return cls(
  File "/openedx/venv/lib/python3.8/site-packages/celery/bin/worker.py", line 223, in run_from_argv
    return self(*args, **options)
  File "/openedx/venv/lib/python3.8/site-packages/celery/bin/base.py", line 253, in __call__
    ret = self.run(*args, **kwargs)
  File "/openedx/venv/lib/python3.8/site-packages/celery/bin/worker.py", line 253, in run
    worker = self.app.Worker(
  File "/openedx/venv/lib/python3.8/site-packages/celery/worker/worker.py", line 99, in __init__
    self.app.loader.init_worker()
  File "/openedx/venv/lib/python3.8/site-packages/celery/loaders/base.py", line 114, in init_worker
    self.import_default_modules()
  File "/openedx/venv/lib/python3.8/site-packages/celery/loaders/base.py", line 108, in import_default_modules
    raise response
  File "/openedx/venv/lib/python3.8/site-packages/celery/utils/dispatch/signal.py", line 288, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/openedx/venv/lib/python3.8/site-packages/celery/fixups/django.py", line 84, in on_import_modules
    self.worker_fixup.validate_models()
  File "/openedx/venv/lib/python3.8/site-packages/celery/fixups/django.py", line 123, in validate_models
    run_checks()
  File "/openedx/venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 76, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/openedx/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 416, in check
    for pattern in self.url_patterns:
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/openedx/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 602, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/openedx/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
    return import_module(self.urlconf_name)
  File "/opt/pyenv/versions/3.8.12/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/cms/urls.py", line 57, in <module>
    path('', include('common.djangoapps.student.urls')),
  File "/openedx/venv/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/opt/pyenv/versions/3.8.12/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/common/djangoapps/student/urls.py", line 12, in <module>
    from djangosaml2idp import urls
  File "/openedx/venv/lib/python3.8/site-packages/djangosaml2idp/urls.py", line 3, in <module>
    from . import views
  File "/openedx/venv/lib/python3.8/site-packages/djangosaml2idp/views.py", line 35, in <module>
    raise ImproperlyConfigured("SAML_IDP_SPCONFIG not defined in settings.")
django.core.exceptions.ImproperlyConfigured: SAML_IDP_SPCONFIG not defined in settings.
2024-04-26 20:24:26,707 ERROR 1 [celery.utils.dispatch.signal] [user None] [ip None] signal.py:292 - Signal handler <bound method DjangoFixup.on_import_modules of <celery.fixups.django.DjangoFixup object at 0x78e71345ed90>> raised: ImproperlyConfigured('SAML_IDP_SPCONFIG not defined in settings.')
Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/djangosaml2idp/views.py", line 33, in <module>
    idp_sp_config = settings.SAML_IDP_SPCONFIG
  File "/openedx/venv/lib/python3.8/site-packages/django/conf/__init__.py", line 83, in __getattr__
    val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'SAML_IDP_SPCONFIG'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/openedx/venv/lib/python3.8/site-packages/celery/utils/dispatch/signal.py", line 288, in send
    response = receiver(signal=self, sender=sender, **named)
  File "/openedx/venv/lib/python3.8/site-packages/celery/fixups/django.py", line 84, in on_import_modules
    self.worker_fixup.validate_models()
  File "/openedx/venv/lib/python3.8/site-packages/celery/fixups/django.py", line 123, in validate_models
    run_checks()
  File "/openedx/venv/lib/python3.8/site-packages/django/core/checks/registry.py", line 76, in run_checks
    new_errors = check(app_configs=app_configs, databases=databases)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 13, in check_url_config
    return check_resolver(resolver)
  File "/openedx/venv/lib/python3.8/site-packages/django/core/checks/urls.py", line 23, in check_resolver
    return check_method()
  File "/openedx/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 416, in check
    for pattern in self.url_patterns:
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/openedx/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 602, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/openedx/venv/lib/python3.8/site-packages/django/utils/functional.py", line 48, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/openedx/venv/lib/python3.8/site-packages/django/urls/resolvers.py", line 595, in urlconf_module
    return import_module(self.urlconf_name)
  File "/opt/pyenv/versions/3.8.12/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/cms/urls.py", line 57, in <module>
    path('', include('common.djangoapps.student.urls')),
  File "/openedx/venv/lib/python3.8/site-packages/django/urls/conf.py", line 34, in include
    urlconf_module = import_module(urlconf_module)
  File "/opt/pyenv/versions/3.8.12/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
  File "<frozen importlib._bootstrap>", line 991, in _find_and_load
  File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 843, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/openedx/edx-platform/common/djangoapps/student/urls.py", line 12, in <module>
    from djangosaml2idp import urls
  File "/openedx/venv/lib/python3.8/site-packages/djangosaml2idp/urls.py", line 3, in <module>
    from . import views
  File "/openedx/venv/lib/python3.8/site-packages/djangosaml2idp/views.py", line 35, in <module>
    raise ImproperlyConfigured("SAML_IDP_SPCONFIG not defined in settings.")
django.core.exceptions.ImproperlyConfigured: SAML_IDP_SPCONFIG not defined in settings.