keystone/keystone/tests/unit/common
Stephen Finucane f174b4fa7c sql: Integrate alembic
Switch to alembic for real by integrating it into the 'db sync' command
flow. From a user-facing perspective, things should remain pretty much
the same as before, with the key difference being that version
information (i.e. what's shown by 'keystone-manage db_sync --check' or
'keystone-manage db_version') will now take the form of a hash rather
than an integer. There are a few differences for contributors however.
The changes are described in the included release note and
documentation.

Note that there are a couple of important design decisions here that are
worth examining:

- We drop the idea of the 'data_migration' branch entirely and the
  'keystone-manage db_sync --migrate' command is now a no-op. Neutron
  doesn't do data migrations like we do and yet they manage just fine.
  Dropping this gets us closer to neutron's behavior, which is a good
  thing for users.

- We haven't re-added the ability to specify a version when doing
  'db_sync'. Neutron has this, but the logic needed to get this working
  is complex and of questionable value. We've managed without the
  ability to sync to a version since Newton and can continue to do so
  until someone asks for it (and does the work).

- sqlalchemy-migrate is not removed entirely. Instead, upon doing a
  'db_sync' we will apply all sqlalchemy-migrate migrations up to the
  final '079_expand_update_local_id_limit' migration and dummy apply the
  initial alembic migration, after which we will switch over to alembic.
  In a future release we can remove the sqlalchemy-migrate migrations
  and rely entirely on alembic. Until then, keeping this allows fast
  forward upgrades to continue as a thing.

- Related to the above, we always apply *all* sqlalchemy-migrate
  migrations when calling 'db_sync', even if this command is called with
  e.g. '--expand' (meaning only apply the expand branch). This is
  because there is at most one "real" migration to apply, the Xena-era
  '079_expand_update_local_id_limit' migration, which is an expand-only
  migration. There is no risk to applying the empty "data_migration" and
  "contract" parts of this migration, and applying everything in one go
  results in *much* simpler logic.

Future changes will update documentation and add developer tooling for
(auto-)generating new migrations, a la 'neutron-db-manage revision'.

Change-Id: Ia376cb87f5159a4e79e2cfbab8442b6bcead708f
Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
2022-06-20 13:29:58 +01:00
..
sql sql: Integrate alembic 2022-06-20 13:29:58 +01:00
__init__.py Always hash passwords on their way into the DB 2014-02-20 13:06:37 +00:00
test_cache.py Distributed cache namespace to invalidate regions 2016-08-29 16:38:55 +00:00
test_database_conflicts.py Finish refactoring self.*_api out of tests 2018-02-05 23:26:08 +00:00
test_json_home.py Use https for docs.openstack.org references 2017-01-30 16:05:08 -08:00
test_notifications.py Merge "Replace assertItemsEqual with assertCountEqual" 2021-12-22 02:44:20 +00:00
test_provider_api.py Fix RBACEnforcer get_member_from_driver mechanism 2018-09-10 13:32:14 -07:00
test_rbac_enforcer.py Switch from mock to unittest.mock use 2020-03-02 13:40:40 -06:00
test_resource_options_common.py Code-Defined Resource-specific Options 2017-01-25 16:15:44 -08:00
test_sql_core.py Do not call `to_dict` outside of a session context 2017-01-25 06:12:20 +00:00
test_utils.py Remove six usage 2020-01-30 06:06:51 +00:00