[BUILD-422] migrate users who does not have membership (PR #2150)

:link: Motivation and Context

BUILD-422: Migrate users who does not have membership

:hammer: Description

In this pull request, I’m updating a signal to create a Stripe customer and a membership after email confirmation. Additionally, I’m creating a script to add a membership for all users who don’t have one, using the Basic/Free plan for all of them.

:eyes: Steps to reproduce

Checkout this branch and query your local database for users without a membership or customer ID. After that, run the script and check if all users now have a Basic/Free and inactive membership. Additionally, verify that customer IDs are updated for users who didn’t have one. Also, create a new account and confirm the email. After the email confirmation, the user from the new account should have an inactive membership with the Basic/Free plan.

Screenshots

Users without a subscription.

running script

Running the same query after executing the script.

GitHub

:mag: Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

:page_facing_up: File: ankihub/memberships/services.py

Function Unhandled Issue
get_or_create_membership AttributeError: ‘NoneType’ object has no attribute ‘get’ /scholarship-requ…
Event Count: 14

Did you find this useful? React with a :+1: or :-1:

The author of this PR, scpaes, is not an activated member of this organization on Codecov.
Please activate this user on Codecov to display this PR comment.
Coverage data is still being uploaded to Codecov.io for purposes of overall coverage calculations.
Please don’t hesitate to email us at support@codecov.io with any questions.

we usually use Factory Boy on our tests, I.E

    return UserFactory.build_batch(10)