Skip to content

Instantly share code, notes, and snippets.

@efischer19
Last active October 27, 2015 20:29
Show Gist options
  • Save efischer19/e7d892654210ec04a458 to your computer and use it in GitHub Desktop.
Save efischer19/e7d892654210ec04a458 to your computer and use it in GitHub Desktop.
Statements run:
mysql> select * from course_groups_courseusergroup;
mysql> select * from course_groups_courseusergroup_users;
mysql> select * from course_groups_cohortmembership;
mysql> insert into course_groups_courseusergroup_users values (4, 1, 3);
edxapp@precise64:~/edx-platform$ ./manage.py lms --settings=devstack migrate course_groups
----clear database, at migration 0004----
mysql> select * from course_groups_courseusergroup;
Empty set (0.00 sec)
mysql> select * from course_groups_courseusergroup_users;
Empty set (0.00 sec)
mysql> select * from course_groups_cohortmembership;
ERROR 1146 (42S02): Table 'edxapp.course_groups_cohortmembership' doesn't exist
----clear database, at migration 0004----
----added cohorts using LMS GUI----
mysql> select * from course_groups_courseusergroup;
+----+--------+---------------------------------+------------+
| id | name | course_id | group_type |
+----+--------+---------------------------------+------------+
| 1 | test 1 | course-v1:edX+DemoX+Demo_Course | cohort |
| 2 | test 2 | course-v1:edX+DemoX+Demo_Course | cohort |
+----+--------+---------------------------------+------------+
2 rows in set (0.00 sec)
mysql> select * from course_groups_courseusergroup_users;
Empty set (0.00 sec)
mysql> select * from course_groups_cohortmembership;
ERROR 1146 (42S02): Table 'edxapp.course_groups_cohortmembership' doesn't exist
----added cohorts using LMS GUI----
----assign users to a single cohort using LMS GUI, as defined in master----
mysql> select * from course_groups_courseusergroup;
+----+--------+---------------------------------+------------+
| id | name | course_id | group_type |
+----+--------+---------------------------------+------------+
| 1 | test 1 | course-v1:edX+DemoX+Demo_Course | cohort |
| 2 | test 2 | course-v1:edX+DemoX+Demo_Course | cohort |
+----+--------+---------------------------------+------------+
2 rows in set (0.00 sec)
mysql> select * from course_groups_courseusergroup_users;
+----+--------------------+---------+
| id | courseusergroup_id | user_id |
+----+--------------------+---------+
| 3 | 1 | 1 |
| 2 | 2 | 3 |
| 1 | 2 | 4 |
+----+--------------------+---------+
3 rows in set (0.00 sec)
mysql> select * from course_groups_cohortmembership;
ERROR 1146 (42S02): Table 'edxapp.course_groups_cohortmembership' doesn't exist
----assign users to a single cohort using LMS GUI, as defined in master----
----manually add user_id 3 to courseusergroup_id 1 as well----
mysql> insert into course_groups_courseusergroup_users values (4, 1, 3);
Query OK, 1 row affected (0.00 sec)
mysql> select * from course_groups_courseusergroup;
+----+--------+---------------------------------+------------+
| id | name | course_id | group_type |
+----+--------+---------------------------------+------------+
| 1 | test 1 | course-v1:edX+DemoX+Demo_Course | cohort |
| 2 | test 2 | course-v1:edX+DemoX+Demo_Course | cohort |
+----+--------+---------------------------------+------------+
2 rows in set (0.00 sec)
mysql> select * from course_groups_courseusergroup_users;
+----+--------------------+---------+
| id | courseusergroup_id | user_id |
+----+--------------------+---------+
| 3 | 1 | 1 |
| 4 | 1 | 3 |
| 2 | 2 | 3 |
| 1 | 2 | 4 |
+----+--------------------+---------+
4 rows in set (0.00 sec)
mysql> select * from course_groups_cohortmembership;
ERROR 1146 (42S02): Table 'edxapp.course_groups_cohortmembership' doesn't exist
----manually add user_id 3 to courseusergroup_id 1 as well----
----now, switch to new branch and run schema + data migrations----
edxapp@precise64:~/edx-platform$ ./manage.py lms --settings=devstack migrate course_groups
Running migrations for course_groups:
- Migrating forwards to 0006_cohort_membership_data_migrate.
> course_groups:0005_cohort_membership
> course_groups:0006_cohort_membership_data_migrate
- Migration 'course_groups:0006_cohort_membership_data_migrate' is marked for no-dry-run.
- Loading initial data for course_groups.
Installed 0 object(s) from 0 fixture(s)
mysql> select * from course_groups_courseusergroup;
+----+--------+---------------------------------+------------+
| id | name | course_id | group_type |
+----+--------+---------------------------------+------------+
| 1 | test 1 | course-v1:edX+DemoX+Demo_Course | cohort |
| 2 | test 2 | course-v1:edX+DemoX+Demo_Course | cohort |
+----+--------+---------------------------------+------------+
2 rows in set (0.00 sec)
mysql> select * from course_groups_courseusergroup_users;
+----+--------------------+---------+
| id | courseusergroup_id | user_id |
+----+--------------------+---------+
| 3 | 1 | 1 |
| 4 | 1 | 3 |
| 1 | 2 | 4 |
+----+--------------------+---------+
3 rows in set (0.00 sec)
mysql> select * from course_groups_cohortmembership;
+----+----------------------+---------+---------------------------------+
| id | course_user_group_id | user_id | course_id |
+----+----------------------+---------+---------------------------------+
| 1 | 1 | 1 | course-v1:edX+DemoX+Demo_Course |
| 2 | 1 | 3 | course-v1:edX+DemoX+Demo_Course |
| 3 | 2 | 4 | course-v1:edX+DemoX+Demo_Course |
+----+----------------------+---------+---------------------------------+
3 rows in set (0.00 sec)
----now, switch to new branch and run schema + data migrations----
----move a user to a different cohort using LMS running new code----
mysql> select * from course_groups_courseusergroup;
+----+--------+---------------------------------+------------+
| id | name | course_id | group_type |
+----+--------+---------------------------------+------------+
| 1 | test 1 | course-v1:edX+DemoX+Demo_Course | cohort |
| 2 | test 2 | course-v1:edX+DemoX+Demo_Course | cohort |
+----+--------+---------------------------------+------------+
2 rows in set (0.00 sec)
mysql> select * from course_groups_courseusergroup_users;
+----+--------------------+---------+
| id | courseusergroup_id | user_id |
+----+--------------------+---------+
| 3 | 1 | 1 |
| 5 | 2 | 3 |
| 1 | 2 | 4 |
+----+--------------------+---------+
3 rows in set (0.00 sec)
mysql> select * from course_groups_cohortmembership;
+----+----------------------+---------+---------------------------------+
| id | course_user_group_id | user_id | course_id |
+----+----------------------+---------+---------------------------------+
| 1 | 1 | 1 | course-v1:edX+DemoX+Demo_Course |
| 2 | 2 | 3 | course-v1:edX+DemoX+Demo_Course |
| 3 | 2 | 4 | course-v1:edX+DemoX+Demo_Course |
+----+----------------------+---------+---------------------------------+
3 rows in set (0.00 sec)
----move a user to a different cohort using LMS running new code----
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment