keystone/keystone/common/sql/migrations
Stephen Finucane 1bcf8cee0d sql: Add support for auto-generation
Add the ability to autogenerate migrations. Because we need to support
different types of migration (expand and contract), this ends up being
significantly more complicated than what was needed in nova and cinder
and more akin to what was done in neutron. The key feature is here is
the use of an alembic hook called 'process_revision_directives', which
is called whenever one calls 'alembic revision --autogenerate'. We
extend this to allow us to hook into the autogeneration process and
ensure we only spit out directives for the relevant phase.

While we're here, we open up the Bobcat DB branch. This is similar to
what Neutron do (e.g. change I13ba740d245a46c41a969ff198e08ddff896eb1a).
Documentation will follow.

Change-Id: I17c9ff9508c5e2bd9521c18973af093d7550ab5a
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2023-02-28 17:47:57 +00:00
..
versions sql: Add support for auto-generation 2023-02-28 17:47:57 +00:00
README.rst sql: Add initial alembic scaffolding 2022-01-21 13:39:30 +00:00
__init__.py sql: Add support for auto-generation 2023-02-28 17:47:57 +00:00
autogen.py sql: Add support for auto-generation 2023-02-28 17:47:57 +00:00
env.py sql: Add support for auto-generation 2023-02-28 17:47:57 +00:00
manage.py sql: Add support for auto-generation 2023-02-28 17:47:57 +00:00
script.py.mako sql: Add initial alembic scaffolding 2022-01-21 13:39:30 +00:00

README.rst

Migrations for the database

This directory contains migrations for the database. These are implemented using alembic, a lightweight database migration tool designed for usage with SQLAlchemy.

The best place to start understanding Alembic is with its own tutorial. You can also play around with the alembic command:

$ alembic --help