You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: readme-docs/CONTRIBUTING.md
+58Lines changed: 58 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -65,6 +65,64 @@ This will result in a new file in the `dojo/db_migrations` folder that can be co
65
65
When making downstream database model changes in your fork of Defect Dojo please be aware of the risks of getting out of sync with our upstream migrations.
66
66
It requiers proper knowledge of [Django Migrations](https://docs.djangoproject.com/en/5.0/topics/migrations/) to reconcile the migrations before you can upgrade to a newer version of Defect Dojo.
67
67
68
+
### Linear Migration History
69
+
70
+
DefectDojo uses [django-linear-migrations](https://github.com/adamchainz/django-linear-migrations) to maintain a linear migration history and avoid merge migration conflicts.
71
+
72
+
**What this means for you:**
73
+
- When you run `makemigrations`, a `max_migration.txt` file is automatically updated in `dojo/db_migrations/`
74
+
- This file tracks the latest migration and must be committed along with your migration file
75
+
- If you're working on a feature branch and migrations are added to `dev` branch, you may encounter a merge conflict in `max_migration.txt`
76
+
77
+
**Resolving migration conflicts:**
78
+
79
+
If you encounter a conflict in `dojo/db_migrations/max_migration.txt` during a rebase or merge, follow these steps:
80
+
81
+
1.**Abort the current rebase/merge** (you can't switch branches while in conflict):
82
+
```bash
83
+
git rebase --abort
84
+
# OR if you were merging: git merge --abort
85
+
```
86
+
87
+
2.**Reverse your migration** from your local database (you're still on your feature branch):
88
+
```bash
89
+
# First, check the conflicting migration number (look at your latest migration file)
90
+
# Then migrate back to the last migration before yours
- If your feature branch has multiple commits modifying the same migration, squash them first before rebasing
123
+
- To find the "last migration before yours", look at your migration file's dependencies
124
+
- It's also possible to skip steps 1-3 and then in step 6 do `python manage.py migrate dojo XXXX_last_migration_before_yours` and `python manage.py migrate dojo --fake` to skip your migrations if they have already been applied during earlier development.
125
+
68
126
## Submitting Pull Requests
69
127
70
128
The following are things to consider before submitting a pull request to
0 commit comments