Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Add django-migration-git-conflict to prevent divergent migration merges (#4075)

sarayourfriend173686edc1f4
diff --git a/api/Pipfile b/api/Pipfile
index 5fd61c5f2..0b20337d3 100644
--- a/api/Pipfile
+++ b/api/Pipfile
@@ -27,6 +27,7 @@ Django = "~=4.2"
django-asgi-lifespan = "~=0.1"
django-cors-headers = "~=4.2"
django-log-request-id = "~=2.0"
+django-migrations-git-conflicts = "~=1.0"
django-oauth-toolkit = "~=2.3"
django-redis = "~=5.4"
django-split-settings = "*"
diff --git a/api/Pipfile.lock b/api/Pipfile.lock
index b49ef9c9f..bae79361d 100644
--- a/api/Pipfile.lock
+++ b/api/Pipfile.lock
@@ -1,7 +1,7 @@
{
"_meta": {
"hash": {
- "sha256": "591d8699e5c18f042a0008fb0481e3eaf6ce68d0ab2df7cc88b92636cb4a2e85"
+ "sha256": "b2f719d742c2bf15c8e1a610091eeeb7fc38d54c6a095980b18d32780ec69cb8"
},
"pipfile-spec": 6,
"requires": {
@@ -409,6 +409,14 @@
"index": "pypi",
"version": "==2.1.0"
},
+ "django-migrations-git-conflicts": {
+ "hashes": [
+ "sha256:0692b04079bbcbf9c40a665ef89804b70fd6a8ff909523b64be65ea37ae203bc",
+ "sha256:c40288560f19edb614acd3327d1788072f4d265d5612a257d22058671de1b871"
+ ],
+ "index": "pypi",
+ "version": "==1.0"
+ },
"django-oauth-toolkit": {
"hashes": [
"sha256:47dfeab97ec21496f307c2cf3468e64ca08897fa499bf3104366d32005c9111d",
diff --git a/api/conf/settings/base.py b/api/conf/settings/base.py
index de29e8934..c5041be5f 100644
--- a/api/conf/settings/base.py
+++ b/api/conf/settings/base.py
@@ -12,6 +12,7 @@ INSTALLED_APPS = [
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
+ "migrations_git_conflicts",
]
MIDDLEWARE = [
diff --git a/api/latest_migrations/README b/api/latest_migrations/README
new file mode 100644
index 000000000..4999b0d99
--- /dev/null
+++ b/api/latest_migrations/README
@@ -0,0 +1,7 @@
+The contents of this directory is autogenerated and shouldn't be modified
+manually. It stores the latest migration of each of the installed applications.
+When two git branches are merged, and they contain different sets of migrations,
+a merge migration has to be applied on top of them. This is enforced by putting
+the name of the latest migration to the file in this directory, and if two
+branches have different migrations, there will be a conflict in this file which
+will stop git from doing an unsafe merge.
diff --git a/api/latest_migrations/api b/api/latest_migrations/api
new file mode 100644
index 000000000..c96d6825e
--- /dev/null
+++ b/api/latest_migrations/api
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+0058_moderation_decision
diff --git a/api/latest_migrations/corsheaders b/api/latest_migrations/corsheaders
new file mode 100644
index 000000000..65df5b27c
--- /dev/null
+++ b/api/latest_migrations/corsheaders
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+
diff --git a/api/latest_migrations/django.contrib.admin b/api/latest_migrations/django.contrib.admin
new file mode 100644
index 000000000..0dd6ae9fb
--- /dev/null
+++ b/api/latest_migrations/django.contrib.admin
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+0003_logentry_add_action_flag_choices
diff --git a/api/latest_migrations/django.contrib.auth b/api/latest_migrations/django.contrib.auth
new file mode 100644
index 000000000..e28fe7737
--- /dev/null
+++ b/api/latest_migrations/django.contrib.auth
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+0012_alter_user_first_name_max_length
diff --git a/api/latest_migrations/django.contrib.contenttypes b/api/latest_migrations/django.contrib.contenttypes
new file mode 100644
index 000000000..5fcc72812
--- /dev/null
+++ b/api/latest_migrations/django.contrib.contenttypes
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+0002_remove_content_type_name
diff --git a/api/latest_migrations/django.contrib.messages b/api/latest_migrations/django.contrib.messages
new file mode 100644
index 000000000..65df5b27c
--- /dev/null
+++ b/api/latest_migrations/django.contrib.messages
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+
diff --git a/api/latest_migrations/django.contrib.sessions b/api/latest_migrations/django.contrib.sessions
new file mode 100644
index 000000000..5de3f6170
--- /dev/null
+++ b/api/latest_migrations/django.contrib.sessions
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+0001_initial
diff --git a/api/latest_migrations/django.contrib.staticfiles b/api/latest_migrations/django.contrib.staticfiles
new file mode 100644
index 000000000..65df5b27c
--- /dev/null
+++ b/api/latest_migrations/django.contrib.staticfiles
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+
diff --git a/api/latest_migrations/drf_spectacular b/api/latest_migrations/drf_spectacular
new file mode 100644
index 000000000..65df5b27c
--- /dev/null
+++ b/api/latest_migrations/drf_spectacular
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+
diff --git a/api/latest_migrations/migrations_git_conflicts b/api/latest_migrations/migrations_git_conflicts
new file mode 100644
index 000000000..65df5b27c
--- /dev/null
+++ b/api/latest_migrations/migrations_git_conflicts
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+
diff --git a/api/latest_migrations/oauth2_provider b/api/latest_migrations/oauth2_provider
new file mode 100644
index 000000000..678fd09fe
--- /dev/null
+++ b/api/latest_migrations/oauth2_provider
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+0007_application_post_logout_redirect_uris
diff --git a/api/latest_migrations/rest_framework b/api/latest_migrations/rest_framework
new file mode 100644
index 000000000..65df5b27c
--- /dev/null
+++ b/api/latest_migrations/rest_framework
@@ -0,0 +1,5 @@
+# This file is autogenerated by makemigrations.
+# If you have a merge conflict in this file, it means you need to run:
+# manage.py makemigrations --merge
+# in order to resolve the conflict between migrations.
+