Skip to content

Commit 91fe85f

Browse files
committed
- Added exception of usercourse - user and course index constraint
1 parent 8005b23 commit 91fe85f

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lms/lmsdb/bootstrap.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,11 +298,8 @@ def _add_user_course_constaint() -> bool:
298298
'usercourse', ('user_id', 'course_id'), True,
299299
),
300300
)
301-
except OperationalError as e:
302-
if 'already exists' in str(e):
303-
log.info(f'index usercourse already exists: {e}')
304-
else:
305-
raise
301+
except (OperationalError, ProgrammingError) as e:
302+
log.info(f'Index usercourse user and course already exists: {e}')
306303
db_config.database.commit()
307304

308305

0 commit comments

Comments
 (0)