openstack-manuals/doc/common/section_keystone_db_sync.xml
Diane Fleming 64b6c9261e Folder rename, file rename, flattening of directories
Current folder name	New folder name	        Book title
----------------------------------------------------------
basic-install 	        DELETE
cli-guide	        DELETE
common	                common
NEW	                admin-guide-cloud	Cloud Administrators Guide
docbkx-example	        DELETE
openstack-block-storage-admin 	DELETE
openstack-compute-admin 	DELETE
openstack-config 	config-reference	OpenStack Configuration Reference
openstack-ha 	        high-availability-guide	OpenStack High Availabilty Guide
openstack-image	        image-guide	OpenStack Virtual Machine Image Guide
openstack-install 	install-guide	OpenStack Installation Guide
openstack-network-connectivity-admin 	admin-guide-network 	OpenStack Networking Administration Guide
openstack-object-storage-admin 	DELETE
openstack-security 	security-guide	OpenStack Security Guide
openstack-training 	training-guide	OpenStack Training Guide
openstack-user 	        user-guide	OpenStack End User Guide
openstack-user-admin 	user-guide-admin	OpenStack Admin User Guide
glossary	        NEW        	OpenStack Glossary

bug: #1220407

Change-Id: Id5ffc774b966ba7b9a591743a877aa10ab3094c7
author: diane fleming
2013-09-08 15:15:50 -07:00

69 lines
3.3 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<section xmlns="http://docbook.org/ns/docbook"
xmlns:xi="http://www.w3.org/2001/XInclude"
xmlns:xlink="http://www.w3.org/1999/xlink" version="5.0"
xml:id="keystone-db_sync">
<title>Migrate the Identity Service Database</title>
<para>Between revisions of the Identity service project code-named
keystone, SQL migrations may need to happen. The keystone
project uses <link
xlink:href="http://code.google.com/p/sqlalchemy-migrate/"
>SQLAlchemy-migrate</link> to migrate the SQL database
between revisions. For core components, the source code stores
migrations in a central repository under a
<filename>keystone/common/sql/migrate_repo</filename>
directory.</para>
<para>Extensions to the Identity service may require SQL
migrations as well. The directory
<filename>keystone/contrib/example</filename> in the
keystone repository contains a sample extension
migration.</para>
<procedure>
<title>To set up a migration for an extension</title>
<step>
<para>Create a directory structure where "my_extension" is
the name of the extension:
<filename>keystone/contrib/my_extension/migrate_repo/versions/</filename></para>
</step>
<step>
<para>Create empty <filename>__init__.py</filename> files in the <filename>migrate_repo</filename>
and <filename>versions</filename> subdirectories.</para>
</step>
<step>
<para>Create a configuration file in the migrate_repo
subdirectory named <filename>migrate.cfg</filename> conforming to a
key/value ini file format.</para>
<para>Here is an example config file.</para>
<programlisting language="ini">[db_settings]
repository_id=my_extension
version_table=migrate_version
required_dbs=[]</programlisting>
</step>
</procedure>
<procedure>
<title>To test and run a migration for a specific
extension</title>
<para>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.</para>
<step>
<para>Test your migrations with "example" as a named
extension:</para>
<screen><prompt>#</prompt> <userinput>bin/keystone-manage db_sync --extension example</userinput></screen>
</step>
<step>
<para>Migrate to version 1 with this command:</para>
<screen><prompt>#</prompt> <userinput>bin/keystone-manage db_sync --extension example 1</userinput></screen>
</step>
<step>
<para>Migrate back to version 0 with this command:</para>
<screen><prompt>#</prompt> <userinput>bin/keystone-manage db_sync --extension example 0</userinput></screen>
</step>
<step>
<para>Use this command to check the version:</para>
<screen><prompt>#</prompt> <userinput>bin/keystone-manage db_version --extension example</userinput></screen>
</step>
</procedure>
</section>