qinling/qinling/db/sqlalchemy/migration/alembic_migrations
Hervé Beraud ec07bb0f92 Stop to use the __future__ module.
The __future__ module [1] was used in this context to ensure compatibility
between python 2 and python 3.

We previously dropped the support of python 2.7 [2] and now we only support
python 3 so we don't need to continue to use this module and the imports
listed below.

Imports commonly used and their related PEPs:
- `division` is related to PEP 238 [3]
- `print_function` is related to PEP 3105 [4]
- `unicode_literals` is related to PEP 3112 [5]
- `with_statement` is related to PEP 343 [6]
- `absolute_import` is related to PEP 328 [7]

[1] https://docs.python.org/3/library/__future__.html
[2] https://governance.openstack.org/tc/goals/selected/ussuri/drop-py27.html
[3] https://www.python.org/dev/peps/pep-0238
[4] https://www.python.org/dev/peps/pep-3105
[5] https://www.python.org/dev/peps/pep-3112
[6] https://www.python.org/dev/peps/pep-0343
[7] https://www.python.org/dev/peps/pep-0328

Change-Id: Ib53d957262f26ef777bde428aca28156bea84687
2020-06-02 20:55:03 +02:00
..
versions Improve function_alias integration 2019-08-10 19:40:02 +12:00
README.md Add runtimes rest api 2017-05-05 15:57:52 +12:00
__init__.py Add runtimes rest api 2017-05-05 15:57:52 +12:00
env.py Stop to use the __future__ module. 2020-06-02 20:55:03 +02:00
script.py.mako Add runtimes rest api 2017-05-05 15:57:52 +12:00

README.md

The migrations in alembic_migrations/versions contain the changes needed to migrate between Qinling database revisions. A migration occurs by executing a script that details the changes needed to upgrade the database. The migration scripts are ordered so that multiple scripts can run sequentially. The scripts are executed by Qinling's migration wrapper which uses the Alembic library to manage the migration. Qinling supports migration from Pike or later.

You can upgrade to the latest database version via:

qinling-db-manage --config-file /path/to/qinling.conf upgrade head

To check the current database version:

qinling-db-manage --config-file /path/to/qinling.conf current

To create a script to run the migration offline:

qinling-db-manage --config-file /path/to/qinling.conf upgrade head --sql

To run the offline migration between specific migration versions:

qinling-db-manage --config-file /path/to/qinling.conf upgrade <start version>:<end version> --sql

Upgrade the database incrementally:

qinling-db-manage --config-file /path/to/qinling.conf upgrade --delta <# of revs>

Or, upgrade the database to one newer revision:

qinling-db-manage --config-file /path/to/qinling.conf upgrade +1

Create new revision:

qinling-db-manage --config-file /path/to/qinling.conf revision -m "description of revision" --autogenerate

Create a blank file:

qinling-db-manage --config-file /path/to/qinling.conf revision -m "description of revision"

This command does not perform any migrations, it only sets the revision. Revision may be any existing revision. Use this command carefully.

qinling-db-manage --config-file /path/to/qinling.conf stamp <revision>

To verify that the timeline does branch, you can run this command:

qinling-db-manage --config-file /path/to/qinling.conf check_migration

If the migration path has branch, you can find the branch point via:

qinling-db-manage --config-file /path/to/qinling.conf history