keystone/keystone/common/sql/migrations
Stephen Finucane 535bc8e22e sql: Remove duplicate constraints
A primary key is automatically unique, therefore if one or columns is
included in a primary key constraint there is no need to add a separate
unique constraint for these columns. Remove it.

Note that this only affects MySQL. Both SQLite and PostgreSQL appear to
ignore the duplicate unique constraint. As a result, it was necessary to
run auto-generation against MySQL instead of the default SQLite. The
actual command used was similar to what we normally do, however.

  $ python keystone/common/sql/migrations/manage.py revision \
      --autogenerate --message 'Remove duplicate constraints'

As always, the resulting schema migrations then needed some manual
tweaks to remove "please adjust!" comments and unnecessary imports but
they are correct.

Change-Id: I64252086f994901a5ebe05afec37a6afd3a192ee
Signed-off-by: Stephen Finucane <sfinucan@redhat.com>
2023-04-06 11:23:03 +01:00
..
versions sql: Remove duplicate constraints 2023-04-06 11:23:03 +01: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: Remove duplicate constraints 2023-04-06 11:23:03 +01: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