Last active
April 23, 2024 09:09
-
-
Save agusmakmun/1c7245b3039bdd02e3471e83077cc4b3 to your computer and use it in GitHub Desktop.
Revisions
-
agusmakmun revised this gist
Apr 23, 2024 . 1 changed file with 9 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -61,6 +61,15 @@ Check out this issue for more information: https://github.com/dj-stripe/dj-strip stripe>=4.0.0,<5.0.0 # https://github.com/dj-stripe/dj-stripe/issues/1842#issuecomment-1319185657 ``` ### 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 - https://stackoverflow.com/a/31122841 -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 15 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,34 +1,33 @@ ### Background In this article, we will share how to upgrade the dj-stripe package flawlessly and carefully. As we know, 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.** ### How to do it? For example, if your dj-stripe version is 2.4.0 and your migration files are referring to the old version.  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. 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). | Old Migration | New Migration | | ------------- | ------------- | |  |  | 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 @@ -48,15 +47,15 @@ Running migrations: Applying djstripe.0008_2_5... OK ``` 8. And then, after migrating it, change your migration file to refer to the new version (e.g., from `0006_2_3` to `0008_2_5`).  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. ``` stripe>=4.0.0,<5.0.0 # https://github.com/dj-stripe/dj-stripe/issues/1842#issuecomment-1319185657 -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 5 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -60,4 +60,8 @@ Check this issue for more: https://github.com/dj-stripe/dj-stripe/issues/1842#is ``` stripe>=4.0.0,<5.0.0 # https://github.com/dj-stripe/dj-stripe/issues/1842#issuecomment-1319185657 ``` ### Alternatives - https://stackoverflow.com/a/31122841 -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ First, you need to find which version that having that old migration. For exampl 2. Visit this link to find it: https://github.com/dj-stripe/dj-stripe/tags 3. Cross check the release notes. 4. Find which dj-stripe version that still compatible with your migration file, e.g: `0006_2_3.py` 5. Find the last migration file of latest version https://github.com/dj-stripe/dj-stripe/tree/2.5.0/djstripe/migrations (e.g: `0008_2_5.py`) (both files must be exists, if not exists mean the new version not compatible anymore with your version). | Old Migration | New Migration | | ------------- | ------------- | -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ First, you need to find which version that having that old migration. For exampl 2. Visit this link to find it: https://github.com/dj-stripe/dj-stripe/tags 3. Cross check the release notes. 4. Find which dj-stripe version that still compatible with your migration file, e.g: `0006_2_3.py` 5. Find the last migration file of latest version https://github.com/dj-stripe/dj-stripe/tree/2.5.0/djstripe/migrations (e.g: `0008_2_5.py`) (both files must be exist, if not exist mean the new version not yet compatible with your version). | Old Migration | New Migration | | ------------- | ------------- | -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -48,7 +48,7 @@ Running migrations: Applying djstripe.0008_2_5... OK ``` 8. And then after migrate it, change your migration file to use the referer of new version (e.g: from `0006_2_3` to `0008_2_5`)  -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,9 +23,9 @@ First, you need to find which version that having that old migration. For exampl 4. Find which dj-stripe version that still compatible with your migration file, e.g: `0006_2_3.py` 5. Find the last migration file of latest version https://github.com/dj-stripe/dj-stripe/tree/2.5.0/djstripe/migrations (e.g: `0008_2_5.py`) | Old Migration | New Migration | | ------------- | ------------- | |  |  | 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 be fail, if fail cross-check no.1-6)_. -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 4 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,14 +22,11 @@ First, you need to find which version that having that old migration. For exampl 3. Cross check the release notes. 4. Find which dj-stripe version that still compatible with your migration file, e.g: `0006_2_3.py` 5. Find the last migration file of latest version https://github.com/dj-stripe/dj-stripe/tree/2.5.0/djstripe/migrations (e.g: `0008_2_5.py`)   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 be fail, if fail cross-check no.1-6)_. @@ -51,6 +48,10 @@ Running migrations: Applying djstripe.0008_2_5... OK ``` 8. And change your migration file to use the referer of new version (e.g: `0006_2_3` to `0008_2_5`)  9. Repeat the same process for higher version. -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,7 +31,7 @@ First, you need to find which version that having that old migration. For exampl  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 be fail, if fail cross-check no.1-6)_. ```console (env-my-project) ➜ my-project git:(development) ✗ docker-compose -f local.yml run django python manage.py migrate djstripe -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ In this article we will share how to upgrade the dj-stripe package flawlessly an As we know the dj-stripe always squash the migration files. \ Which mean, his migration files are totally changed, and because of this will lead the migration issues. > **So, you can't immediatelly upgrade your package too far, e.g: from 2.4.0 to 2.7.0, \ because it will cause breaking changes, especially in your database migrations.** -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,8 +20,9 @@ First, you need to find which version that having that old migration. For exampl 1. Search the latest version that close with your package version, e.g: 2.4.0 to 2.5.0 2. Visit this link to find it: https://github.com/dj-stripe/dj-stripe/tags 3. Cross check the release notes. 4. Find which dj-stripe version that still compatible with your migration file, e.g: `0006_2_3.py` 5. Find the last migration file of latest version https://github.com/dj-stripe/dj-stripe/tree/2.5.0/djstripe/migrations (e.g: `0008_2_5.py`) 6. And change your migration file to use it.  -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -20,7 +20,7 @@ First, you need to find which version that having that old migration. For exampl 1. Search the latest version that close with your package version, e.g: 2.4.0 to 2.5.0 2. Visit this link to find it: https://github.com/dj-stripe/dj-stripe/tags 3. Cross check the release notes. 4. Find the last migration file of latest version https://github.com/dj-stripe/dj-stripe/tree/2.5.0/djstripe/migrations (e.g: `0008_2_5.py`) 5. And change your migration file to use it.  -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 8 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -51,3 +51,11 @@ Running migrations: ``` 9. Repeat the same process for higher version. If you have an issue with stripe version, we can try upgrade it as well in the `requirements.txt` file. Check this issue for more: 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 ``` -
agusmakmun revised this gist
Apr 22, 2024 . 1 changed file with 20 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -31,3 +31,23 @@ First, you need to find which version that having that old migration. For exampl 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 be fail, if fail cross-check no.1-5)_. ```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 ✔ Container my-project-mailhog-1 Running 0.0s ✔ Container my-project-postgres-1 Running 0.0s PostgreSQL is available System check identified some issues: WARNINGS: ?: (djstripe.W001) The Stripe API version has a non-default value of '2024-04-10'. Non-default versions are not explicitly supported, and may cause compatibility issues. HINT: Use the dj-stripe default for Stripe API version: 2020-08-27 Operations to perform: Apply all migrations: djstripe Running migrations: Applying djstripe.0008_2_5... OK ``` 9. Repeat the same process for higher version. -
agusmakmun created this gist
Apr 22, 2024 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,33 @@ ### Background In this article we will share how to upgrade the dj-stripe package flawlessly and carefully. As we know the dj-stripe always squash the migration files. \ Which mean, his migration files are totally changed, and because of this will lead the migration issues. > **So, you can't immediatelly upgrade your package, e.g: from 2.4.0 to 2.7.0, \ because it will cause breaking changes, especially in your database migrations.** ### How to do it? For example, your dj-stripe version is 2.4.0 and if your migration files refering to the old version.  First, you need to find which version that having that old migration. For example: 1. Search the latest version that close with your package version, e.g: 2.4.0 to 2.5.0 2. Visit this link to find it: https://github.com/dj-stripe/dj-stripe/tags 3. Cross check the release notes. 4. Find the last migration file of latest version https://github.com/dj-stripe/dj-stripe/tree/2.5.0/djstripe/migrations 5. And change your migration file to use it.    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 be fail, if fail cross-check no.1-5)_.