Skip to content

Commit 8005b23

Browse files
committed
fix: Migrating tables
- Added exception of exercise - course and number indexes migration
1 parent 2c71ba3 commit 8005b23

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
@@ -284,11 +284,8 @@ def _add_exercise_course_id_and_number_columns_constraint() -> bool:
284284
migrate(
285285
migrator.add_index('exercise', ('course_id', 'number'), True),
286286
)
287-
except OperationalError as e:
288-
if 'already exists' in str(e):
289-
log.info(f'index exercise already exists: {e}')
290-
else:
291-
raise
287+
except (OperationalError, ProgrammingError) as e:
288+
log.info(f'Index exercise course and number already exists: {e}')
292289
db_config.database.commit()
293290

294291

0 commit comments

Comments
 (0)