deb-sahara/savanna/db/migration
Sergey Lukjanov 013c84cb3e Upgrade migration script to the latest model.
Change-Id: I6d463794e4f2764f27ea1dcbeee7755019d44bc1
2013-06-22 23:36:06 +04:00
..
alembic_migrations Upgrade migration script to the latest model. 2013-06-22 23:36:06 +04:00
__init__.py Initial version of Savanna v0.2 2013-05-31 13:22:37 +04:00
alembic.ini Initial version of Savanna v0.2 2013-05-31 13:22:37 +04:00
cli.py Initial version of Savanna v0.2 2013-05-31 13:22:37 +04:00
README Initial version of Savanna v0.2 2013-05-31 13:22:37 +04:00

# Copyright (c) 2013 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.

You can then upgrade to the latest database version via:
$ savanna-db-manage --config-file /path/to/savanna.conf upgrade head

To check the current database version:
$ savanna-db-manage --config-file /path/to/savanna.conf current

To create a script to run the migration offline:
$ savanna-db-manage --config-file /path/to/savanna.conf upgrade head --sql

To run the offline migration between specific migration versions:
$ savanna-db-manage --config-file /path/to/savanna.conf upgrade \
    <start version>:<end version> --sql

Upgrade the database incrementally:
$ savanna-db-manage --config-file /path/to/savanna.conf upgrade --delta \
    <# of revs>

Downgrade the database by a certain number of revisions:
$ savanna-db-manage --config-file /path/to/savanna.conf downgrade --delta \
    <# of revs>


Create new revision:
$ savanna-db-manage --config-file /path/to/savanna.conf revision \
    -m "description of revision" --autogenerate

Create a blank file:
$ savanna-db-manage --config-file /path/to/savanna.conf revision \
    -m "description of revision"

To verify that the timeline does branch, you can run this command:
$ savanna-db-manage --config-file /path/to/savanna.conf check_migration

If the migration path does branch, you can find the branch point via:
$ savanna-db-manage --config-file /path/to/savanna.conf history