Error in Discovery after Upgrading from Iromwood to Juinper

I am getting the following error in discovery admin after upgrading from Ironwood to Juniper.

I have migrated the database from Ironwood to Juniper and then executed the following command:

/edx/bin/edxapp-migrate-lms
/edx/bin/edxapp-migrate-cms

LMS and CMS are working properly but getting error in discovery admin.


logs of discovery:

[service_variant=discovery][django.request] ERROR [ip-172-30-0-22 2949] [/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/utils/log.py:228] - Internal Server Error: /admin/course_metadata/program/
Traceback (most recent call last):
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/backends/utils.py”, line 84, in _execute
return self.cursor.execute(sql, params)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/backends/mysql/base.py”, line 71, in execute
return self.cursor.execute(query, args)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/MySQLdb/cursors.py”, line 209, in execute
res = self._query(query)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/MySQLdb/cursors.py”, line 315, in _query
db.query(q)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/MySQLdb/connections.py”, line 239, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.OperationalError: (1054, “Unknown column ‘core_partner.lms_coursemode_api_url’ in ‘field list’”)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/core/handlers/exception.py”, line 34, in inner
response = get_response(request)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/core/handlers/base.py”, line 115, in _get_response
response = self.process_exception_by_middleware(e, request)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/core/handlers/base.py”, line 113, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File “/usr/lib/python3.5/contextlib.py”, line 30, in inner
return func(*args, **kwds)
File “/usr/lib/python3.5/contextlib.py”, line 30, in inner
return func(*args, **kwds)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/options.py”, line 606, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/utils/decorators.py”, line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/views/decorators/cache.py”, line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/sites.py”, line 223, in inner
return view(request, *args, **kwargs)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/utils/decorators.py”, line 45, in _wrapper
return bound_method(*args, **kwargs)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/utils/decorators.py”, line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/options.py”, line 1685, in changelist_view
cl = self.get_changelist_instance(request)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/options.py”, line 744, in get_changelist_instance
sortable_by,
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/views/main.py”, line 81, in init
self.queryset = self.get_queryset(request)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/views/main.py”, line 405, in get_queryset
filters_use_distinct) = self.get_filters(request)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/views/main.py”, line 135, in get_filters
self.model, self.model_admin, field_path=field_path,
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/filters.py”, line 159, in create
return list_filter_class(field, request, params, model, model_admin, field_path=field_path)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/filters.py”, line 170, in init
self.lookup_choices = self.field_choices(field, request, model_admin)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/contrib/admin/filters.py”, line 201, in field_choices
return field.get_choices(include_blank=False, ordering=ordering)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/fields/init.py”, line 837, in get_choices
(choice_func(x), str(x)) for x in qs
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/query.py”, line 274, in iter
self._fetch_all()
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/query.py”, line 1242, in _fetch_all
self._result_cache = list(self._iterable_class(self))
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/query.py”, line 55, in iter
results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/sql/compiler.py”, line 1142, in execute_sql
cursor.execute(sql, params)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/backends/utils.py”, line 67, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/backends/utils.py”, line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/backends/utils.py”, line 84, in _execute
return self.cursor.execute(sql, params)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/utils.py”, line 89, in exit
raise dj_exc_value.with_traceback(traceback) from exc_value
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/backends/utils.py”, line 84, in _execute
return self.cursor.execute(sql, params)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/backends/mysql/base.py”, line 71, in execute
return self.cursor.execute(query, args)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/MySQLdb/cursors.py”, line 209, in execute
res = self._query(query)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/MySQLdb/cursors.py”, line 315, in _query
db.query(q)
File “/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/MySQLdb/connections.py”, line 239, in query
_mysql.connection.query(self, query)
django.db.utils.OperationalError: (1054, “Unknown column ‘core_partner.lms_coursemode_api_url’ in ‘field list’”)

I have got the solution for the above error.

We also need to run a migration script for the Discovery Services.

sudo -Hs -u discovery
source ~/discovery_env
source ~/venvs/discovery/bin/activate
cd ~/discovery
./manage.py makemigrations
./manage.py migrate