aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author0livd <github@destras.fr>2018-10-13 18:36:08 +0200
committer0livd <github@destras.fr>2018-12-07 22:52:30 +0100
commit5b5956d86dc1131c2cfdd587dc6abf476c30bd6d (patch)
tree122245050006d307fa99add46f2fdd1bc25f794c
parent5bd839e176328de942c4e2f499cfb621200be001 (diff)
downloadihatemoney-mirror-5b5956d86dc1131c2cfdd587dc6abf476c30bd6d.zip
ihatemoney-mirror-5b5956d86dc1131c2cfdd587dc6abf476c30bd6d.tar.gz
ihatemoney-mirror-5b5956d86dc1131c2cfdd587dc6abf476c30bd6d.tar.bz2
Document database migrations
Closes #390
-rw-r--r--CHANGELOG.rst1
-rw-r--r--Makefile5
-rw-r--r--docs/contributing.rst16
3 files changed, 21 insertions, 1 deletions
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 95f3d34..59cd0e5 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -35,6 +35,7 @@ Added
- Improve settings documentation styling (#251)
- Add a ihatemoney delete-project command to delete a project (#375)
- Add nice 404 error pages (#379)
+- Document database migrations (#390)
Changed
=======
diff --git a/Makefile b/Makefile
index 8c48ed4..1f36a84 100644
--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,11 @@ create-database-revision: ## Create a new database revision
@read -p "Please enter a message describing this revision: " rev_message; \
$(PYTHON) -m ihatemoney.manage db migrate -d ihatemoney/migrations -m "$${rev_message}"
+.PHONY: create-empty-database-revision
+create-empty-database-revision: ## Create an empty database revision
+ @read -p "Please enter a message describing this revision: " rev_message; \
+ $(PYTHON) -m ihatemoney.manage db revision -d ihatemoney/migrations -m "$${rev_message}"
+
.PHONY: build-requirements
build-requirements: ## Save currently installed packages to requirements.txt
$(VIRTUALENV) $(TEMPDIR)
diff --git a/docs/contributing.rst b/docs/contributing.rst
index 836dc08..b27e3f9 100644
--- a/docs/contributing.rst
+++ b/docs/contributing.rst
@@ -39,7 +39,6 @@ Accessing dev server
In any case, you can point your browser at `http://localhost:5000 <http://localhost:5000>`_.
It's as simple as that!
-
Updating
--------
@@ -47,6 +46,21 @@ In case you want to update to newer versions (from git), you can just run the "u
make update
+Create database migrations
+--------------------------
+
+In case you need to modify the database schema, first update the models in ihatemoney/models.py.
+Then run the following command to create a new database revision file::
+
+ make create-database-revision
+
+If your changes are simple enough, the generated script will be populated with
+the necessary migrations steps.
+For complex migrations, it is recommended to start from an empty revision file which can be created
+with the following command::
+
+ make create-empty-database-revision
+
Useful settings
----------------