]> git.ipfire.org Git - thirdparty/patchwork.git/commitdiff
Add support for 'django-dbbackup'
authorStephen Finucane <stephen@that.guru>
Thu, 13 Sep 2018 18:13:35 +0000 (12:13 -0600)
committerStephen Finucane <stephen@that.guru>
Wed, 10 Oct 2018 09:17:36 +0000 (10:17 +0100)
'parsemail' and 'parsearchive' are slow. When messing with models and
migrations, it can be very useful to backup the database in its current
state and restore it if/when you mess up. Currently, we've documented
how to do this via some commands run in the shell of the container, but
we can do things easier via an application designed for this purpose:
'django-dbshell'.

Signed-off-by: Stephen Finucane <stephen@that.guru>
.gitignore
patchwork/settings/dev.py
requirements-dev.txt

index 57376bdd09039916d28c30cee65cd2668c1a4ba0..a33d102907a82053bb8126c9ebf9b9daa999951a 100644 (file)
@@ -54,3 +54,6 @@ patchwork/settings/production.py
 
 # docker-compose configuration files
 /.env
+
+# django-dbbackup files
+/.backups
index 4bb5a93ce41b400fa14944d6dab507fa213094f6..711177c94730196ca4f74044cb431e1f4f9cdcbf 100644 (file)
@@ -9,6 +9,11 @@ Design based on:
 
 from .base import *  # noqa
 
+try:
+    import dbbackup
+except ImportError:
+    dbbackup = None
+
 #
 # Core settings
 # https://docs.djangoproject.com/en/1.11/ref/settings/#core-settings
@@ -72,6 +77,14 @@ INTERNAL_IPS = [
     '172.18.0.1'
 ]
 
+# django-dbbackup
+
+if dbbackup:
+    INSTALLED_APPS += [
+        'dbbackup',
+    ]
+
+    DBBACKUP_STORAGE_OPTIONS = {'location': '.backups'}
 
 #
 # Patchwork settings
index b0cdd0de7796bf764faaff9338935ac46ccd8d8f..ed98c30ec86b3dd6fcfdead0669583eac1855b24 100644 (file)
@@ -3,4 +3,5 @@ Django==1.11.15; python_version < '3.0'  # pyup: ignore
 djangorestframework==3.8.2
 django-filter==2.0.0; python_version >= '3.4'
 django-filter==1.1.0; python_version < '3.0'  # pyup: ignore
+django-dbbackup==3.2.0
 -r requirements-test.txt