sahara/savanna/db/migration
Nikita Konovalov e9eb475891 Added __init__.py to migration directory
Fixes: bug #1201956

Change-Id: I836df5821acdfae9095cdb469859bbd6379439a7
2013-07-19 12:24:51 +04:00
..
alembic_migrations Added __init__.py to migration directory 2013-07-19 12:24:51 +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