Skip to content

feat: command to migrate v1 to v2 lib references#825

Merged
asadali145 merged 10 commits into
mainfrom
asad/course-lib-content-migration
Jul 16, 2026
Merged

feat: command to migrate v1 to v2 lib references#825
asadali145 merged 10 commits into
mainfrom
asad/course-lib-content-migration

Conversation

@asadali145

@asadali145 asadali145 commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

What are the relevant tickets?

https://github.com/mitodl/hq/issues/12148

Description (What does it do?)

Adds a command to update v1 library references to v2 library

How can this be tested?

  • Setup plugin by following the readme.
  • Checkout asad/v1-v2-lib-migration-fixes-and-command for edx-platform branch
  • Create source and target courses and make sure the mapping exists.
  • Create legacy library content in source course and publish it. Verify it exists in target course.
  • Run the command ./manage.py cms migrate_legacy_library_blocks_to_item_bank --course-ids <SOURCE_COURSE_ID> --persist-publish-state
  • Verify the block is updated to V2 in both child and source course and published with --persist-publish-state flag.

@asadali145

Copy link
Copy Markdown
Contributor Author

Marked this as WIP, Will move to review after the upstream PR is merged openedx/openedx-platform#38865

@asadali145

Copy link
Copy Markdown
Contributor Author

@arslanashraf7, this should be ready for review.

@arslanashraf7 arslanashraf7 self-assigned this Jul 13, 2026

@arslanashraf7 arslanashraf7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of small changes.

Copilot AI review requested due to automatic review settings July 16, 2026 09:31
@asadali145
asadali145 requested a review from arslanashraf7 July 16, 2026 09:32
@asadali145

Copy link
Copy Markdown
Contributor Author

@arslanashraf7, I have added the review changes, an enhancement to validate that the course exists, and also added tests for the command. This should be good for another look.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a CMS management command in ol_openedx_course_sync to queue migration of legacy (v1) library_content blocks to v2 item bank references, with supporting utility/helpers, documentation, and test coverage.

Changes:

  • Introduces migrate_legacy_library_blocks_to_item_bank management command with --course-ids, --all-source-courses, and --persist-publish-state options.
  • Adds get_all_source_courses() utility plus unit tests for it.
  • Adds command docs to the plugin README and bumps plugin version to 1.0.1.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
src/ol_openedx_course_sync/ol_openedx_course_sync/management/commands/migrate_legacy_library_blocks_to_item_bank.py Adds the new CMS management command that queues the edx-platform migration task.
src/ol_openedx_course_sync/ol_openedx_course_sync/utils.py Adds get_all_source_courses() helper used by the command.
src/ol_openedx_course_sync/tests/test_migrate_legacy_library_blocks_to_item_bank.py Adds tests covering command argument handling and task queuing behavior.
src/ol_openedx_course_sync/tests/test_utils.py Adds tests for get_all_source_courses() and updates imports for new test setup.
src/ol_openedx_course_sync/README.rst Documents command usage, options, and examples.
src/ol_openedx_course_sync/pyproject.toml Bumps plugin version for the new feature.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/ol_openedx_course_sync/ol_openedx_course_sync/utils.py Outdated
@asadali145
asadali145 force-pushed the asad/course-lib-content-migration branch from 40411ec to 5a4fa86 Compare July 16, 2026 09:52
@asadali145
asadali145 requested a review from Copilot July 16, 2026 09:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Comment thread src/ol_openedx_course_sync/ol_openedx_course_sync/utils.py Outdated
Comment thread src/ol_openedx_course_sync/README.rst

@arslanashraf7 arslanashraf7 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving with an important comment.

…ommands/migrate_legacy_library_blocks_to_item_bank.py

Co-authored-by: Arslan Ashraf <34372316+arslanashraf7@users.noreply.github.com>
@asadali145
asadali145 merged commit 1bc9676 into main Jul 16, 2026
9 checks passed
@asadali145
asadali145 deleted the asad/course-lib-content-migration branch July 16, 2026 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants