Browse Source

Add tox job for db revision creation

Trivial-Fix

Change-Id: Ie87b84ddd546149ca5d9eaf2179c514071c75695
Marc Koderer 2 years ago
parent
commit
829052d6dd
2 changed files with 16 additions and 0 deletions
  1. 12
    0
      doc/source/devref/database.rst
  2. 4
    0
      tox.ini

+ 12
- 0
doc/source/devref/database.rst View File

@@ -52,3 +52,15 @@ Tests
52 52
 
53 53
 Tests are lacking for the db api layer and for the sqlalchemy driver.
54 54
 Failures in the drivers would be detected in other test cases, though.
55
+
56
+DB migration revisions
57
+----------------------
58
+
59
+If a DB schema needs to be updated, a new DB migration file needs to be added
60
+in ``manila/db/migrations/alembic/versions``. To create such a file it's
61
+possible to use ``manila-manage db revision`` or the corresponding tox command::
62
+
63
+   tox -e dbrevision "change_foo_table"
64
+
65
+In addition every migration script must be tested. See examples in
66
+``manila/tests/db/migrations/alembic/migrations_data_checks.py``.

+ 4
- 0
tox.ini View File

@@ -90,6 +90,10 @@ deps = -r{toxinidir}/requirements.txt
90 90
        pylint==0.26.0
91 91
 commands = python tools/lintstack.py check
92 92
 
93
+[testenv:dbrevision]
94
+deps = -r{toxinidir}/requirements.txt
95
+commands = alembic -c manila/db/migrations/alembic.ini revision -m ""{posargs}
96
+
93 97
 [flake8]
94 98
 # Following checks are ignored on purpose:
95 99
 ignore = 

Loading…
Cancel
Save