Skip to content

Conversation

@artem-vavilov
Copy link
Member

@artem-vavilov artem-vavilov requested review from a team February 11, 2026 15:18
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 46e654e1ab

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Base automatically changed from P20-1796/lti-course-duplicates-fix to staging February 11, 2026 18:14
Copy link
Contributor

@carl-codeorg carl-codeorg left a comment

Choose a reason for hiding this comment

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

Does this migration need to wait until we manually resolve existing duplicate records?

@artem-vavilov
Copy link
Member Author

artem-vavilov commented Feb 11, 2026

Does this migration need to wait until we manually resolve existing duplicate records?

Yes, otherwise it fails. But we do not have to hard delete duplicate records because soft deleted records are ignored

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3efc7196b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

class AddUniqueIndexToLtiCoursesOnLtiIntegrationIdAndContextIdAndActive < ActiveRecord::Migration[6.1]
def up
execute <<~SQL.squish
CREATE UNIQUE INDEX index_lti_courses_on_context_integration_active ON lti_courses (

Choose a reason for hiding this comment

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

P1 Badge Deduplicate active rows before creating unique index

CREATE UNIQUE INDEX will abort this migration as soon as lti_courses contains any existing duplicate active pair (context_id, lti_integration_id with deleted_at IS NULL), and there is no cleanup step in this change to make those rows unique first. In environments that already accumulated duplicates, deploy will fail at migration time; add a pre-index data migration (or equivalent dedupe step) before creating the constraint.

Useful? React with 👍 / 👎.

@sureshc
Copy link
Contributor

sureshc commented Feb 11, 2026

Should we provision a clone of our production database to test this change?

@artem-vavilov
Copy link
Member Author

artem-vavilov commented Feb 11, 2026

Should we provision a clone of our production database to test this change?

The unit tests should be enough to confirm it works as expected, and since there are only about 10,000 records, creating this index should not be an issue once we remove the existing duplicates

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants