django-migration-zero 2.0.0__tar.gz → 2.0.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (73) hide show
  1. django_migration_zero-2.0.2/.ambient-package-update/metadata.py +37 -0
  2. django_migration_zero-2.0.2/.ambient-package-update/templates/snippets/content.tpl +28 -0
  3. django_migration_zero-2.0.2/.ambient-package-update/templates/snippets/installation.tpl +34 -0
  4. django_migration_zero-2.0.2/.ambient-package-update/templates/snippets/tagline.tpl +6 -0
  5. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/.github/workflows/ci.yml +0 -6
  6. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/.pre-commit-config.yaml +3 -3
  7. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/CHANGES.md +6 -0
  8. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/PKG-INFO +8 -7
  9. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/README.md +6 -5
  10. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/__init__.py +1 -1
  11. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/conf.py +1 -1
  12. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/pyproject.toml +1 -1
  13. django_migration_zero-2.0.0/.ambient-package-update/metadata.py +0 -79
  14. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/.coveragerc +0 -0
  15. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/.editorconfig +0 -0
  16. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/.gitignore +0 -0
  17. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/.readthedocs.yaml +0 -0
  18. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/LICENSE.md +0 -0
  19. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/MANIFEST.in +0 -0
  20. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/admin.py +0 -0
  21. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/apps.py +0 -0
  22. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/exceptions.py +0 -0
  23. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/helpers/__init__.py +0 -0
  24. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/helpers/file_system.py +0 -0
  25. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/helpers/logger.py +0 -0
  26. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/locale/de/LC_MESSAGES/django.mo +0 -0
  27. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/locale/de/LC_MESSAGES/django.po +0 -0
  28. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/management/__init__.py +0 -0
  29. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/management/commands/__init__.py +0 -0
  30. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/management/commands/handle_migration_zero_reset.py +0 -0
  31. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/management/commands/reset_local_migration_files.py +0 -0
  32. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/managers.py +0 -0
  33. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/migrations/0001_initial.py +0 -0
  34. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/migrations/__init__.py +0 -0
  35. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/models.py +0 -0
  36. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/services/__init__.py +0 -0
  37. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/services/deployment.py +0 -0
  38. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/services/local.py +0 -0
  39. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/django_migration_zero/settings.py +0 -0
  40. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/Makefile +0 -0
  41. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/features/01_introduction.md +0 -0
  42. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/features/02_configuration.md +0 -0
  43. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/features/03_workflow.md +0 -0
  44. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/features/04_common_issues_and_solutions.md +0 -0
  45. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/features/05_architecture.md +0 -0
  46. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/features/06_management_commands.md +0 -0
  47. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/features/07_changelog.rst +0 -0
  48. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/index.rst +0 -0
  49. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/docs/make.bat +0 -0
  50. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/manage.py +0 -0
  51. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/scripts/unix/install_requirements.sh +0 -0
  52. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/scripts/unix/publish_to_pypi.sh +0 -0
  53. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/scripts/windows/install_requirements.ps1 +0 -0
  54. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/scripts/windows/publish_to_pypi.ps1 +0 -0
  55. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/settings.py +0 -0
  56. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/setup.cfg +0 -0
  57. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/testapp/__init__.py +0 -0
  58. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/testapp/urls.py +0 -0
  59. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/__init__.py +0 -0
  60. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/helpers/__init__.py +0 -0
  61. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/helpers/test_file_system.py +0 -0
  62. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/helpers/test_logger.py +0 -0
  63. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/management/__init__.py +0 -0
  64. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/management/commands/__init__.py +0 -0
  65. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/management/commands/test_handle_migration_zero_reset.py +0 -0
  66. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/management/commands/test_reset_local_migration_files.py +0 -0
  67. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/services/__init__.py +0 -0
  68. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/services/test_deployment.py +0 -0
  69. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/services/test_local.py +0 -0
  70. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/test_admin.py +0 -0
  71. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/test_managers.py +0 -0
  72. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/test_models.py +0 -0
  73. {django_migration_zero-2.0.0 → django_migration_zero-2.0.2}/tests/test_settings.py +0 -0
@@ -0,0 +1,37 @@
1
+ from ambient_package_update.metadata.author import PackageAuthor
2
+ from ambient_package_update.metadata.constants import (
3
+ DEV_DEPENDENCIES,
4
+ LICENSE_MIT,
5
+ SUPPORTED_DJANGO_VERSIONS,
6
+ SUPPORTED_PYTHON_VERSIONS,
7
+ )
8
+ from ambient_package_update.metadata.maintainer import PackageMaintainer
9
+ from ambient_package_update.metadata.package import PackageMetadata
10
+ from ambient_package_update.metadata.readme import ReadmeContent
11
+
12
+ METADATA = PackageMetadata(
13
+ package_name="django_migration_zero",
14
+ module_name="django_migration_zero",
15
+ authors=[
16
+ PackageAuthor(
17
+ name="Ambient Digital",
18
+ email="hello@ambient.digital",
19
+ ),
20
+ ],
21
+ maintainer=PackageMaintainer(name="Ambient Digital", url="https://ambient.digital/", email="hello@ambient.digital"),
22
+ company="Ambient Innovation: GmbH",
23
+ license=LICENSE_MIT,
24
+ license_year=2023,
25
+ development_status="5 - Production/Stable",
26
+ has_migrations=True,
27
+ readme_content=ReadmeContent(uses_internationalisation=True),
28
+ dependencies=[
29
+ "Django>=3.2",
30
+ ],
31
+ supported_django_versions=SUPPORTED_DJANGO_VERSIONS,
32
+ supported_python_versions=SUPPORTED_PYTHON_VERSIONS,
33
+ optional_dependencies={
34
+ "dev": [*DEV_DEPENDENCIES, "unittest-parametrize~=1.3"],
35
+ },
36
+ ruff_ignore_list=[],
37
+ )
@@ -0,0 +1,28 @@
1
+ ## Features
2
+
3
+ * Remove all existing local migration files and recreate them as initial migrations
4
+ * Configuration singleton in Django admin to prepare your clean-up deployment
5
+ * Management command for your pipeline to update Django's migration history table to reflect the changed migrations
6
+
7
+ ## Motivation
8
+
9
+ Working with any proper ORM will result in database changes which are reflected in migration files to update your
10
+ different environment's database structure. These files are versioned in your repository and if you follow any of the
11
+ most popular deployment approaches, they won't be needed when they are deployed on production. This means, they clutter
12
+ your repo, might lead to merge conflicts in the future and will slow down your test setup.
13
+
14
+ Django's default way of handling this is called "squashing". This approach is covered broadly in the
15
+ [official documentation](https://docs.djangoproject.com/en/dev/topics/migrations/#migration-squashing). The main
16
+ drawback here is, that you have to take care of circular dependencies between models. Depending on your project's
17
+ size, this can take a fair amount of time.
18
+
19
+ The main benefit of squashing migrations is, that the history stays intact, therefore it can be used for example in
20
+ package which can be installed by anybody and you don't have control over their database.
21
+
22
+ If you are working on a "regular" application, you have full control over your data(bases) and once everything has
23
+ been applied on the "last" system, typically production, the migrations are obsolete. To avoid spending much time on
24
+ fixing squashed migrations you won't need, you can use the "migration zero" pattern. In a nutshell, this means:
25
+
26
+ * Delete all your local migration files
27
+ * Recreate initial migration files containing your current model state
28
+ * Fix the migration history on every of your environments
@@ -0,0 +1,34 @@
1
+ ## Installation
2
+
3
+ - Install the package via pip:
4
+
5
+ `pip install {{ package_name|replace("_", "-") }}`
6
+
7
+ or via pipenv:
8
+
9
+ `pipenv install {{ package_name|replace("_", "-") }}`
10
+
11
+ - Add module to `INSTALLED_APPS` within the main django `settings.py`:
12
+
13
+ ````
14
+ INSTALLED_APPS = (
15
+ ...
16
+ '{{ package_name }}',
17
+ )
18
+ ````
19
+
20
+ {% if has_migrations %}
21
+ - Apply migrations by running:
22
+
23
+ `python ./manage.py migrate`
24
+ {% endif %}
25
+
26
+ - Add this block to your loggers in your main Django `settings.py` to show logs in your console.
27
+
28
+ ```python
29
+ "django_migration_zero": {
30
+ "handlers": ["console"],
31
+ "level": "INFO",
32
+ "propagate": True,
33
+ },
34
+ ```
@@ -0,0 +1,6 @@
1
+ Welcome to **django-migration-zero** - the holistic implementation of "migration zero" pattern for
2
+ Django covering local changes and CI/CD pipeline adjustments.
3
+
4
+ This package implements the "migration zero" pattern to clean up your local migrations and provides convenient
5
+ management commands to recreate your migration files and updating your migration history on your environments
6
+ (like test or production systems).
@@ -46,12 +46,6 @@ jobs:
46
46
  django-version: ['42', '50', ]
47
47
 
48
48
  exclude:
49
- - python-version: '3.12'
50
- django-version: 32
51
- - python-version: '3.11'
52
- django-version: 32
53
- - python-version: '3.10'
54
- django-version: 32
55
49
  - python-version: '3.8'
56
50
  django-version: 50
57
51
  - python-version: '3.9'
@@ -3,7 +3,7 @@
3
3
 
4
4
  repos:
5
5
  - repo: https://github.com/astral-sh/ruff-pre-commit
6
- rev: v0.3.5
6
+ rev: v0.4.8
7
7
  hooks:
8
8
  # Run the Ruff linter.
9
9
  - id: ruff
@@ -12,14 +12,14 @@ repos:
12
12
  - id: ruff-format
13
13
 
14
14
  - repo: https://github.com/asottile/pyupgrade
15
- rev: v3.15.2
15
+ rev: v3.16.0
16
16
  hooks:
17
17
  - id: pyupgrade
18
18
  args: [ --py38-plus ]
19
19
  stages: [ push ]
20
20
 
21
21
  - repo: https://github.com/adamchainz/django-upgrade
22
- rev: 1.16.0
22
+ rev: 1.18.0
23
23
  hooks:
24
24
  - id: django-upgrade
25
25
  args: [--target-version, "4.2"]
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ * *2.0.2* (2024-06-20)
4
+ * Internal updates via `ambient-package-update`
5
+
6
+ * *2.0.1* (2024-06-14)
7
+ * Internal updates via `ambient-package-update`
8
+
3
9
  * *2.0.0* (2024-04-11)
4
10
  * Dropped Django 3.2 & 4.1 support (via `ambient-package-update`)
5
11
  * Internal updates via `ambient-package-update`
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: django-migration-zero
3
- Version: 2.0.0
3
+ Version: 2.0.2
4
4
  Summary: Holistic implementation of "migration zero" pattern for Django covering local changes and in-production database adjustments.
5
5
  Author-email: Ambient Digital <hello@ambient.digital>
6
6
  Description-Content-Type: text/markdown
@@ -34,7 +34,7 @@ Requires-Dist: sphinx-rtd-theme~=2.0 ; extra == "dev"
34
34
  Requires-Dist: m2r2==0.3.3.post2 ; extra == "dev"
35
35
  Requires-Dist: mistune<2.0.0 ; extra == "dev"
36
36
  Requires-Dist: flit~=3.9 ; extra == "dev"
37
- Requires-Dist: ambient-package-update~=24.4.4 ; extra == "dev"
37
+ Requires-Dist: ambient-package-update~=24.6.3 ; extra == "dev"
38
38
  Requires-Dist: unittest-parametrize~=1.3 ; extra == "dev"
39
39
  Project-URL: Bugtracker, https://github.com/ambient-innovation/django-migration-zero/issues
40
40
  Project-URL: Changelog, https://django-migration-zero.readthedocs.io/en/latest/features/changelog.html
@@ -60,7 +60,8 @@ management commands to recreate your migration files and updating your migration
60
60
  * [PyPI](https://pypi.org/project/django-migration-zero/)
61
61
  * [GitHub](https://github.com/ambient-innovation/django-migration-zero)
62
62
  * [Full documentation](https://django-migration-zero.readthedocs.io/en/latest/index.html)
63
- * Creator & Maintainer: [Ambient Digital](https://ambient.digital)
63
+ * Creator & Maintainer: [Ambient Digital](https://ambient.digital/)
64
+
64
65
 
65
66
  ## Features
66
67
 
@@ -93,7 +94,6 @@ fixing squashed migrations you won't need, you can use the "migration zero" patt
93
94
 
94
95
  ## Installation
95
96
 
96
-
97
97
  - Install the package via pip:
98
98
 
99
99
  `pip install django-migration-zero`
@@ -117,8 +117,7 @@ fixing squashed migrations you won't need, you can use the "migration zero" patt
117
117
  `python ./manage.py migrate`
118
118
 
119
119
 
120
- * Add this block to your loggers in your main Django `settings.py` to show
121
- logs in your console.
120
+ - Add this block to your loggers in your main Django `settings.py` to show logs in your console.
122
121
 
123
122
  ```python
124
123
  "django_migration_zero": {
@@ -128,7 +127,6 @@ logs in your console.
128
127
  },
129
128
  ```
130
129
 
131
-
132
130
  ## Contribute
133
131
 
134
132
  ### Setup package for development
@@ -189,6 +187,7 @@ Example: run all hooks of pre-push stage
189
187
  - To build the documentation run: `sphinx-build docs/ docs/_build/html/`.
190
188
  - Open `docs/_build/html/index.html` to see the documentation.
191
189
 
190
+
192
191
  ### Translation files
193
192
 
194
193
  If you have added custom text, make sure to wrap it in `_()` where `_` is
@@ -206,6 +205,7 @@ How to compile translation files:
206
205
  * `python manage.py compilemessages`
207
206
  * Have a look at the new/changed files within `django_migration_zero/locale`
208
207
 
208
+
209
209
  ### Publish to ReadTheDocs.io
210
210
 
211
211
  - Fetch the latest changes in GitHub mirror and push them
@@ -243,3 +243,4 @@ being rendered by this updater. It works similar to well-known updaters like `py
243
243
  To run an update, refer to the [documentation page](https://pypi.org/project/ambient-package-update/)
244
244
  of the "ambient-package-update".
245
245
 
246
+
@@ -15,7 +15,8 @@ management commands to recreate your migration files and updating your migration
15
15
  * [PyPI](https://pypi.org/project/django-migration-zero/)
16
16
  * [GitHub](https://github.com/ambient-innovation/django-migration-zero)
17
17
  * [Full documentation](https://django-migration-zero.readthedocs.io/en/latest/index.html)
18
- * Creator & Maintainer: [Ambient Digital](https://ambient.digital)
18
+ * Creator & Maintainer: [Ambient Digital](https://ambient.digital/)
19
+
19
20
 
20
21
  ## Features
21
22
 
@@ -48,7 +49,6 @@ fixing squashed migrations you won't need, you can use the "migration zero" patt
48
49
 
49
50
  ## Installation
50
51
 
51
-
52
52
  - Install the package via pip:
53
53
 
54
54
  `pip install django-migration-zero`
@@ -72,8 +72,7 @@ fixing squashed migrations you won't need, you can use the "migration zero" patt
72
72
  `python ./manage.py migrate`
73
73
 
74
74
 
75
- * Add this block to your loggers in your main Django `settings.py` to show
76
- logs in your console.
75
+ - Add this block to your loggers in your main Django `settings.py` to show logs in your console.
77
76
 
78
77
  ```python
79
78
  "django_migration_zero": {
@@ -83,7 +82,6 @@ logs in your console.
83
82
  },
84
83
  ```
85
84
 
86
-
87
85
  ## Contribute
88
86
 
89
87
  ### Setup package for development
@@ -144,6 +142,7 @@ Example: run all hooks of pre-push stage
144
142
  - To build the documentation run: `sphinx-build docs/ docs/_build/html/`.
145
143
  - Open `docs/_build/html/index.html` to see the documentation.
146
144
 
145
+
147
146
  ### Translation files
148
147
 
149
148
  If you have added custom text, make sure to wrap it in `_()` where `_` is
@@ -161,6 +160,7 @@ How to compile translation files:
161
160
  * `python manage.py compilemessages`
162
161
  * Have a look at the new/changed files within `django_migration_zero/locale`
163
162
 
163
+
164
164
  ### Publish to ReadTheDocs.io
165
165
 
166
166
  - Fetch the latest changes in GitHub mirror and push them
@@ -197,3 +197,4 @@ being rendered by this updater. It works similar to well-known updaters like `py
197
197
 
198
198
  To run an update, refer to the [documentation page](https://pypi.org/project/ambient-package-update/)
199
199
  of the "ambient-package-update".
200
+
@@ -3,4 +3,4 @@
3
3
  Holistic implementation of "migration zero" pattern for Django covering local changes and in-production database adjustments.
4
4
  """
5
5
 
6
- __version__ = "2.0.0"
6
+ __version__ = "2.0.2"
@@ -37,7 +37,7 @@ from django_migration_zero import __version__ # noqa: E402
37
37
 
38
38
  project = "django-migration-zero"
39
39
  copyright = "2024, Ambient Innovation: GmbH" # noqa: A001
40
- author = "Ambient Innovation: GmbH <hello@ambient.digital>"
40
+ author = "Ambient Digital <hello@ambient.digital>"
41
41
  version = __version__
42
42
  release = __version__
43
43
 
@@ -48,7 +48,7 @@ dev = [
48
48
  'm2r2==0.3.3.post2',
49
49
  'mistune<2.0.0',
50
50
  'flit~=3.9',
51
- 'ambient-package-update~=24.4.4',
51
+ 'ambient-package-update~=24.6.3',
52
52
  'unittest-parametrize~=1.3',
53
53
  ]
54
54
 
@@ -1,79 +0,0 @@
1
- from ambient_package_update.metadata.author import PackageAuthor
2
- from ambient_package_update.metadata.constants import (
3
- DEV_DEPENDENCIES,
4
- LICENSE_MIT,
5
- SUPPORTED_DJANGO_VERSIONS,
6
- SUPPORTED_PYTHON_VERSIONS,
7
- )
8
- from ambient_package_update.metadata.package import PackageMetadata
9
- from ambient_package_update.metadata.readme import ReadmeContent
10
-
11
- METADATA = PackageMetadata(
12
- package_name="django_migration_zero",
13
- authors=[
14
- PackageAuthor(
15
- name="Ambient Digital",
16
- email="hello@ambient.digital",
17
- ),
18
- ],
19
- company="Ambient Innovation: GmbH",
20
- license=LICENSE_MIT,
21
- license_year=2023,
22
- development_status="5 - Production/Stable",
23
- has_migrations=True,
24
- readme_content=ReadmeContent(
25
- tagline="""Welcome to **django-migration-zero** - the holistic implementation of "migration zero" pattern for
26
- Django covering local changes and CI/CD pipeline adjustments.
27
-
28
- This package implements the "migration zero" pattern to clean up your local migrations and provides convenient
29
- management commands to recreate your migration files and updating your migration history on your environments
30
- (like test or production systems).""",
31
- content="""## Features
32
-
33
- * Remove all existing local migration files and recreate them as initial migrations
34
- * Configuration singleton in Django admin to prepare your clean-up deployment
35
- * Management command for your pipeline to update Django's migration history table to reflect the changed migrations
36
-
37
- ## Motivation
38
-
39
- Working with any proper ORM will result in database changes which are reflected in migration files to update your
40
- different environment's database structure. These files are versioned in your repository and if you follow any of the
41
- most popular deployment approaches, they won't be needed when they are deployed on production. This means, they clutter
42
- your repo, might lead to merge conflicts in the future and will slow down your test setup.
43
-
44
- Django's default way of handling this is called "squashing". This approach is covered broadly in the
45
- [official documentation](https://docs.djangoproject.com/en/dev/topics/migrations/#migration-squashing). The main
46
- drawback here is, that you have to take care of circular dependencies between models. Depending on your project's
47
- size, this can take a fair amount of time.
48
-
49
- The main benefit of squashing migrations is, that the history stays intact, therefore it can be used for example in
50
- package which can be installed by anybody and you don't have control over their database.
51
-
52
- If you are working on a "regular" application, you have full control over your data(bases) and once everything has
53
- been applied on the "last" system, typically production, the migrations are obsolete. To avoid spending much time on
54
- fixing squashed migrations you won't need, you can use the "migration zero" pattern. In a nutshell, this means:
55
-
56
- * Delete all your local migration files
57
- * Recreate initial migration files containing your current model state
58
- * Fix the migration history on every of your environments""",
59
- additional_installation="""* Add this block to your loggers in your main Django `settings.py` to show
60
- logs in your console.
61
-
62
- ```python
63
- "django_migration_zero": {
64
- "handlers": ["console"],
65
- "level": "INFO",
66
- "propagate": True,
67
- },
68
- ```""",
69
- ),
70
- dependencies=[
71
- "Django>=3.2",
72
- ],
73
- supported_django_versions=SUPPORTED_DJANGO_VERSIONS,
74
- supported_python_versions=SUPPORTED_PYTHON_VERSIONS,
75
- optional_dependencies={
76
- "dev": [*DEV_DEPENDENCIES, "unittest-parametrize~=1.3"],
77
- },
78
- ruff_ignore_list=[],
79
- )