Skip to content

Feat/admin invite migration ENT- 11235#2492

Open
sjasti-sonata-svg wants to merge 3 commits intoopenedx:masterfrom
sjasti-sonata-svg:feat/admin-invite-migration-ENT-11235
Open

Feat/admin invite migration ENT- 11235#2492
sjasti-sonata-svg wants to merge 3 commits intoopenedx:masterfrom
sjasti-sonata-svg:feat/admin-invite-migration-ENT-11235

Conversation

@sjasti-sonata-svg
Copy link
Copy Markdown
Contributor

Merge checklist:

  • Any new requirements are in the right place (do not manually modify the requirements/*.txt files)
    • base.in if needed in production but edx-platform doesn't install it
    • test-master.in if edx-platform pins it, with a matching version
    • make upgrade && make requirements have been run to regenerate requirements
  • make static has been run to update webpack bundling if any static content was updated
  • ./manage.py makemigrations has been run
    • Checkout the Database Migration Confluence page for helpful tips on creating migrations.
    • Note: This must be run if you modified any models.
      • It may or may not make a migration depending on exactly what you modified, but it should still be run.
    • This should be run from either a venv with all the lms/edx-enterprise requirements installed or if you checked out edx-enterprise into the src directory used by lms, you can run this command through an lms shell.
      • It would be ./manage.py lms makemigrations in the shell.
  • Version bumped
  • Changelog record added
  • Translations updated (see docs/internationalization.rst but also this isn't blocking for merge atm)

Post merge:

  • Tag pushed and a new version released
    • Note: Assets will be added automatically. You just need to provide a tag (should match your version number) and title and description.
  • After versioned build finishes in GitHub Actions, verify version has been pushed to PyPI
    • Each step in the release build has a condition flag that checks if the rest of the steps are done and if so will deploy to PyPi.
      (so basically once your build finishes, after maybe a minute you should see the new version in PyPi automatically (on refresh))
  • PR created in edx-platform to upgrade dependencies (including edx-enterprise)
    • Trigger the 'Upgrade one Python dependency' action against master in edx-platform with new version number to generate version bump PR
    • This must be done after the version is visible in PyPi as make upgrade in edx-platform will look for the latest version in PyPi.
    • Note: the edx-enterprise constraint in edx-platform must also be bumped to the latest version in PyPi.

Comment thread enterprise/models.py
@sjasti-sonata-svg sjasti-sonata-svg force-pushed the feat/admin-invite-migration-ENT-11235 branch from b4b89d2 to 88bd451 Compare December 18, 2025 18:15
Copy link
Copy Markdown
Contributor

@kiram15 kiram15 left a comment

Choose a reason for hiding this comment

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

I know when Troy did his talk about migrations he went into having to do some things in multiple PRs when you are dealing with different situations like dropping a column, but in this case, two PRs are not needed. Also, having the migration separate from your other PR could introduce a lot of problems if these PRs are merged in the incorrect order. I think it would be better to include these changes in this PR so you can avoid that.

Comment thread enterprise/models.py
Comment on lines +1101 to +1105
joined_date = models.DateTimeField(
null=True,
blank=True,
help_text="Timestamp when the user accepted the invite / joined."
)
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.

Similar to my comments in the other PR, joined_date would be redundant with created as this model inherits from TimeStampedModel.

Comment thread enterprise/models.py
Comment on lines +1095 to +1099
invited_date = models.DateTimeField(
null=True,
blank=True,
help_text="Timestamp when the user was invited."
)
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.

I recommend when you add a field you should also add the logic to populate the field in the same PR. for invited_date, you can simply add it here:

enterprise_customer_user, __ = EnterpriseCustomerUser.objects.update_or_create(
enterprise_customer=self.enterprise_customer,
user_id=user.id,
defaults={'active': True},
)

        enterprise_customer_user, __ = EnterpriseCustomerUser.objects.update_or_create(
            enterprise_customer=self.enterprise_customer,
            user_id=user.id,
            defaults={
                'active': True,
                'invited_date': self.created,
            },
        )

Comment thread enterprise/models.py
blank=True,
on_delete=models.SET_NULL,
related_name='enterprise_users_invited',
help_text="Admin user who sent the invitation."
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.

Nit:

Suggested change
help_text="Admin user who sent the invitation."
help_text="LMS user of admin who sent the invitation."

Comment thread CHANGELOG.rst

[6.5.8] - 2025-12-16
---------------------
* feat: Update admin table with new fields
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.

comment is incorrect, as this PR does not update the admin table, it updates the enterprise customer user table.

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.

4 participants