Skip to content

Commit

Permalink
fix: documentation to upgrade dj-stripe not rendered properly
Browse files Browse the repository at this point in the history
  • Loading branch information
Agus Makmun authored and jleclanche committed May 4, 2024
1 parent d4851b3 commit 4986af9
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions docs/upgrade_dj_stripe.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

In this article, we will share how to upgrade the `dj-stripe` package flawlessly and carefully.

!! attention "Important Note"
!!! attention "Important Note"
Please keep in mind that `dj-stripe` always squashes the migration files.
Which means its migration files are completely changed, and leading to migration issues.
**So, you can't immediately upgrade your package too far, for example, from `2.4.0` to `2.7.0` because it will cause breaking changes, especially in your database migrations.**
Expand All @@ -19,10 +19,10 @@ For example, if your `dj-stripe` version is `2.4.0` and your migration files are
First, you need to find which version has that old migration. For example:

1. Search for the latest version that is closest to your package version, for example: `2.4.0` to `2.5.0`.
2. Visit this link to find it: https://github.com/dj-stripe/dj-stripe/tags
2. Visit this link to find it: <https://github.com/dj-stripe/dj-stripe/releases>
3. Cross-check the release notes.
4. Find which dj-stripe version is still compatible with your migration file, for example: `0006_2_3.py`.
5. Find the last migration file of the latest version at https://github.com/dj-stripe/dj-stripe/tree/2.5.0/djstripe/migrations (for example: `0008_2_5.py`) (both files must exist; if not, it means the new version is no longer compatible with your version).
5. Find the last migration file of the latest version at <https://github.com/dj-stripe/dj-stripe/tree/2.5.0/djstripe/migrations> (for example: `0008_2_5.py`) (both files must exist; if not, it means the new version is no longer compatible with your version).

| Old Migration | New Migration |
| ------------- | ------------- |
Expand All @@ -31,7 +31,7 @@ First, you need to find which version has that old migration. For example:
6. Update your `requirements.txt` file from `dj-stripe==2.4.0` to `dj-stripe==2.5.0`
7. Run the `manage.py migrate djstripe` command _(this command must not fail; if it does, cross-check steps 1-6)._

```console
```
(env-my-project) ➜ my-project git:(development) ✗ docker-compose -f local.yml run django python manage.py migrate djstripe
[+] Creating 3/0
✔ Container my-project-redis-1 Running 0.0s
Expand All @@ -54,22 +54,22 @@ Running migrations:
9. Repeat the same process for higher version.


If you have an issue with the Stripe version, we can also try upgrading it in the `requirements.txt` file. \
Check out this issue for more information: https://github.com/dj-stripe/dj-stripe/issues/1842#issuecomment-1319185657.
If you have an issue with the Stripe version, we can also try upgrading it in the `requirements.txt` file.
Check out this issue for more information: <https://github.com/dj-stripe/dj-stripe/issues/1842#issuecomment-1319185657>.

```
stripe>=4.0.0,<5.0.0 # https://github.com/dj-stripe/dj-stripe/issues/1842#issuecomment-1319185657
```


### Conclusion
## Conclusion

1. Find the closest version that compatible with your version _(for doing migration)_.
2. Update the dependency in `requirements.txt` file and then deploy it.
- Don't forget to run the `python manage.py migrate djstripe` command.
3. Change your migration file to refer to the new version (e.g., from `0006_2_3` to `0008_2_5`), and then deploy it.


### Alternatives
## Alternatives

- https://stackoverflow.com/a/31122841
- <https://stackoverflow.com/a/31122841>

0 comments on commit 4986af9

Please sign in to comment.