Migrate the Identity Service Database Between revisions of the Identity service project code-named keystone, SQL migrations may need to happen. The keystone project uses SQLAlchemy-migrate to migrate the SQL database between revisions. For core components, the source code stores migrations in a central repository under a keystone/common/sql/migrate_repo directory. Extensions to the Identity service may require SQL migrations as well. The directory keystone/contrib/example in the keystone repository contains a sample extension migration. To set up a migration for an extension Create a directory structure where "my_extension" is the name of the extension: keystone/contrib/my_extension/migrate_repo/versions/ Create empty __init__.py files in the migrate_repo and versions subdirectories. Create a configuration file in the migrate_repo subdirectory named migrate.cfg conforming to a key/value ini file format. Here is an example config file. [db_settings] repository_id=my_extension version_table=migrate_version required_dbs=[] To test and run a migration for a specific extension You can use the keystone-manage command with the parameter --extension both the db_sync and db_version commands. Ensure the required configuration files exist before doing these steps. Test your migrations with "example" as a named extension: # bin/keystone-manage db_sync --extension example Migrate to version 1 with this command: # bin/keystone-manage db_sync --extension example 1 Migrate back to version 0 with this command: # bin/keystone-manage db_sync --extension example 0 Use this command to check the version: # bin/keystone-manage db_version --extension example