monasca-api/monasca_api/db
Johannes Grassler 0250f81cdc Add monasca_db command line tool
This commit adds a schema management tool for the Monasca
configuration database. Apart from the usual OpenStack schema
management tool subcommands (stamp, upgrade, version) it has
two extra subcommands:

* fingerprint: for computing a SHA1 fingerprint of the
               currently currently active database schema.
* detect-revision: for identifiying the Alembic revision
                   (if any) corresponding to a database
                   schema that was created with one of the
                   legacy SQL scripts.

The data provided by the detect-revision subcommand can be
used for stamping the database with Alembic version metadata
when transitioning an existing Monasca configuration database
to Alembic based database migrations.

Story: 2001654
Task: 14341

Change-Id: Ibdd877a23ab5d6d1bbf8d83515c0197554098526
2018-08-01 11:10:14 +00:00
..
alembic Add monasca_db command line tool 2018-08-01 11:10:14 +00:00
__init__.py Alembic migrations for all SQL script revisions 2018-06-22 08:16:35 +00:00
alembic.ini Alembic migrations for all SQL script revisions 2018-06-22 08:16:35 +00:00
fingerprint.py Add monasca_db command line tool 2018-08-01 11:10:14 +00:00
README Alembic migrations for all SQL script revisions 2018-06-22 08:16:35 +00:00

This directory contains the plumbing for the Alembic migrations that modify the
Monasca database.

If you need to add a new migration, run

  alembic revision -m '<revision message>'

in this directory, where <revision message> is a short description for what
your migration does such as 'Add volume field to alarm'. Alembic will then
create a revision script in the alembic/versions/ directory. You will need to
edit this script to add upwards and downwards migrations for the change you
want to make.