I just tried to upgrade to version 10.0.7, and the same duplicate key problem in MySQL occurred again:
Loading settings lms.envs.tutor.production
Operations to perform:
Apply all migrations: admin, announcements, api_admin, assessment, auth, badges, block_structure, bookmarks, branding, bulk_email, bulk_grades, calendar_sync, catalog, celery_utils, certificates, commerce, completion, consent, content_libraries, content_type_gating, contentserver, contenttypes, cornerstone, cors_csrf, course_action_state, course_date_signals, course_duration_limits, course_goals, course_groups, course_modes, course_overviews, courseware, crawlers, credentials, credit, dark_lang, database_fixups, degreed, discounts, django_comment_common, django_notify, djcelery, edx_proctoring, edx_when, edxval, email_marketing, embargo, enterprise, entitlements, experiments, external_user_ids, grades, instructor_task, integrated_channel, lms_xblock, milestones, mobile_api, oauth2_provider, oauth_dispatch, organizations, program_enrollments, programs, redirects, rss_proxy, sap_success_factors, schedules, self_paced, sessions, shoppingcart, site_configuration, sites, social_django, splash, static_replace, status, student, submissions, super_csv, survey, system_wide_roles, teams, theming, third_party_auth, thumbnail, track, user_api, user_authn, util, verified_track_content, verify_student, video_config, video_pipeline, waffle, waffle_utils, wiki, workflow, xapi, xblock_django
Running migrations:
No migrations to apply.
Traceback (most recent call last):
File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/connections.py", line 239, in query
_mysql.connection.query(self, query)
MySQLdb._exceptions.IntegrityError: (1062, "Duplicate entry 'android' for key 'client_id'")
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "./manage.py", line 123, in <module>
execute_from_command_line([sys.argv[0]] + django_args)
File "/openedx/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/openedx/venv/lib/python3.5/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/openedx/venv/lib/python3.5/site-packages/django/core/management/base.py", line 323, in run_from_argv
self.execute(*args, **cmd_options)
File "/openedx/venv/lib/python3.5/site-packages/django/core/management/base.py", line 364, in execute
output = self.handle(*args, **options)
File "/openedx/edx-platform/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py", line 168, in handle
application = self._create_application(user, app_name, application_kwargs)
File "/openedx/edx-platform/openedx/core/djangoapps/oauth_dispatch/management/commands/create_dot_application.py", line 80, in _create_application
user=user, name=app_name, **application_kwargs
File "/openedx/venv/lib/python3.5/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/openedx/venv/lib/python3.5/site-packages/django/db/models/query.py", line 422, in create
obj.save(force_insert=True, using=self.db)
File "/openedx/venv/lib/python3.5/site-packages/django/db/models/base.py", line 741, in save
force_update=force_update, update_fields=update_fields)
File "/openedx/venv/lib/python3.5/site-packages/django/db/models/base.py", line 779, in save_base
force_update, using, update_fields,
File "/openedx/venv/lib/python3.5/site-packages/django/db/models/base.py", line 870, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/openedx/venv/lib/python3.5/site-packages/django/db/models/base.py", line 908, in _do_insert
using=using, raw=raw)
File "/openedx/venv/lib/python3.5/site-packages/django/db/models/manager.py", line 82, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/openedx/venv/lib/python3.5/site-packages/django/db/models/query.py", line 1186, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/openedx/venv/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1375, in execute_sql
cursor.execute(sql, params)
File "/openedx/venv/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 "/openedx/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 76, in _execute_with_wrappers
return executor(sql, params, many, context)
File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/openedx/venv/lib/python3.5/site-packages/django/db/utils.py", line 89, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "/openedx/venv/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 71, in execute
return self.cursor.execute(query, args)
File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 209, in execute
res = self._query(query)
File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/cursors.py", line 315, in _query
db.query(q)
File "/openedx/venv/lib/python3.5/site-packages/MySQLdb/connections.py", line 239, in query
_mysql.connection.query(self, query)
django.db.utils.IntegrityError: (1062, "Duplicate entry 'android' for key 'client_id'")
Error: Command failed with status 1: docker-compose -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.yml -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.prod.yml --project-name tutor_local -f /home/ubuntu/.local/share/tutor/env/local/docker-compose.jobs.yml run --rm lms-job sh -e -c dockerize -wait tcp://mysql:3306 -timeout 20s
echo "Loading settings $DJANGO_SETTINGS_MODULE"
./manage.py lms migrate
# Create oauth credentials for Android application
./manage.py lms create_dot_application \
--client-id android \
--client-secret 2H7BHqEagqLQUtJwHn1j8U02 \
--grant-type password \
--public \
android \
login_service_user
# Fix incorrect uploaded file path
if [ -d /openedx/data/uploads/ ]; then
if [ -n "$(ls -A /openedx/data/uploads/)" ]; then
echo "Migrating LMS uploaded files to shared directory"
mv /openedx/data/uploads/* /openedx/media/
rm -rf /openedx/data/uploads/
fi
fi
Is there any workaround to this upgrade problem?