Hi All,
There has been some recent instability with course-discovery database migrations, and you may need to clean up your local environment. Before you pull from master, you'll first want to check which migrations you have applied. Note that the following assumes development in devstack. The goal is to end up in the following state:
# ./manage.py showmigrations course_metadata
course_metadata
[X] 0001_squashed_0033_courserun_mobile_available (33 squashed migrations)
...
[X] 0095_icontextpairing
[X] 0096_degree_lead_capture_list_name
[X] 0097_degree_lead_capture_image
[X] 0098_degree_cost_and_deadline
From your devstack directory, run make discovery-shell and then ./manage.py showmigrations course_metadata
If you've only applied up to (and including):
0096_degree_lead_capture_list_name
congratulations, you're in a clean state. You can pull the latest version of course-discovery master and run make discovery-update-db without issue.
If you have applied a migration called 0097_masters_details, you'll need to do the following:
- ./manage.py migrate course_metadata 0096_degree_lead_capture_list_name
- Get into your local MySql shell (make mysql-shell-edxapp from devstack directory). Switch to the discovery database (use discovery;).
- Now: SELECT * FROM django_migrations WHERE app = 'course_metadata'; If there is a row with the migration name 0097_degree_lead_capture_image, delete that row from the table.
- While still in the mysql shell, run describe course_metadata_degree. Confirm that there is no column named "lead_capture_image". If there is, run ALTER TABLE course_metadata_degree DROP COLUMN lead_capture_image;
- Now you can pull from master and run make discovery-update-db
If you're in some other state, or if the instructions above didn't work, you can reach out for help here or in Slack.
Thanks!
Alex