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

bug 1490727: Add stripe customer id to MDN user #5059

Merged
merged 2 commits into from Oct 31, 2018

Conversation

Projects
None yet
2 participants
@michal-macioszczyk
Contributor

michal-macioszczyk commented Oct 31, 2018

As a MDN developer I want users and stripe customers to be linked so that managing user and customer becomes easier.

  • MDN user was updated with new optional field called stripe_customer_id

  • create two separate migrations one for timezone and second one for stripe_customer_id

@jwhitlock

Thanks @michal-macioszczyk, I like that you split the migration into two commits. This works locally, where I ran the migration and then returned to master, which doesn't know about the new field. Let's get this to production before we merge the code that uses it.

@@ -188,6 +188,10 @@ class User(AbstractUser):
blank=True,
validators=[WEBSITE_VALIDATORS['discourse']],
)
stripe_customer_id = models.CharField(

This comment has been minimized.

@jwhitlock

jwhitlock Oct 31, 2018

Member

Migrations are rare enough that I need to think through this, and when I think, I do it in a GitHub comment.

The deployment is done in Jenkins:

utils.migrate_db()
// Start a rolling update of the Kuma-based deployments.
utils.rollout()
// Monitor the rollout until it has completed.
utils.monitor_rollout()
// Record the rollout in external services like New-Relic.
utils.record_rollout()

  1. The database is migrated while the old code is running. Django doesn't use *, but instead asks for each column by name. The old code won't load the new column.
  2. The new code is rolled out. Users have a chance to get the new or old code. If the new code loads a user, it will include the (blank) customer ID.
  3. The new code is rolled out, everything works.

@jwhitlock jwhitlock merged commit b6c2f84 into mozilla:master Oct 31, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
security/snyk - package.json (mdn) No new, high severity issues
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment