Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

corporate: Migrate discounted customer with a required plan tier. #29890

Closed

Conversation

amanagr
Copy link
Member

@amanagr amanagr commented Apr 30, 2024

This will migrate existing customers who don't have a required plan tier but have a discount applied.

@timabbott might better to just run the assertion before deploying the script but I think this should be everything we should be checking here.

This will migrate existing customers who don't have a required plan
tier but have a discount applied.
Comment on lines +55 to +65
if not plan.exists():
# Check that realm has no paid plan.
assert not (
Realm.objects.filter(id=customer.realm_id)
.filter(plan_type__in=REALM_PAID_PLANS)
.exists()
), f"Customer {customer.id} has no paid plan but realm has paid plan. Manually migrate the customer."
print(f"Customer {customer.id} has discount but no paid plan. Resetting discount.")
customer.default_discount = None
customer.save(update_fields=["default_discount"])
continue
Copy link
Member Author

@amanagr amanagr Apr 30, 2024

Choose a reason for hiding this comment

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

Ideally we should also reset minimum licenses for the customer which is set after discount is applied but I think it is not we want for some customers due to legacy reasons.

@amanagr
Copy link
Member Author

amanagr commented Jun 8, 2024

Closing this since the migration was manually done by Tim.

@amanagr amanagr closed this Jun 8, 2024
@amanagr amanagr deleted the required_plan_tier_customer_migration branch June 8, 2024 05:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants