Skip to content

Migrating users from old to new CantusDB

Jiwoo Jeong edited this page Aug 12, 2022 · 5 revisions

Before following the steps below, please ensure that "Setting up user permissions and privileges in the new CantusDB" has been completed already.

  1. Delete all, if any, users in the Django admin interface.
  2. Place id_username_email.csv (obtained from Junhao) into the same directory as oldcantususer_uid_role.csv.
  3. Run python old_users_list.py. Using oldcantususer_uid_role.csv (which has rows of user_uid-role pairs) and id_username_email.csv (which has rows of user_uid-email pairs (for some index i, row[i] of both oldcantususer_uid_role.csv and id_username_email.csv have the same user_uid)), this script will scrape user data from the old CantusDB's user-detail page into a new file called oldcantususer_uid_role_detailed.csv.
  4. Run python manage.py add_all_users. Using oldcantususer_uid_role_detailed.csv (where each row contains data for one user), this command will read the file row-by-row and create a new user with the row-specified data (if they do not already exist), or update them appropriately (if the user already exists). Also, this command will read editors_source.csv to assign users to sources that they were previously assigned to in the old CantusDB. After this step, all users should have been successfully migrated.
  5. Run python manage.py createsuperuser to create an admin account.

IMPORTANT:

Do not commit id_username_email.csv and oldcantususer_uid_role_detailed.csv, as they contain users' emails