Integrate Rally & Alembic

Alembic allows us to change in future DB schema,
which we are going to do soon.

This patch adds under rally/common/db/sqlalchemy/migrations
required files for alembic as well as a first init migrations
that was autogenerated from models that we have.

As well this patch adds CLI commands for DB management

Change-Id: I7caa090aa5c4c6563b7e34d0d09baa039a3aa718
Co-Authored-By: Illia Khudoshyn <ikhudoshyn@mirantis.com>
This commit is contained in:
Boris Pavlovic 2016-01-07 02:22:16 -08:00 committed by Illia Khudoshyn
parent 485310c16a
commit a8de21a077
4 changed files with 6 additions and 3 deletions

View File

@ -5,3 +5,4 @@ source = rally
[report]
ignore_errors = True
precision = 3
omit = */migrations/versions/ca3626f62937_init_migration.py

View File

@ -33,6 +33,7 @@ Contents
user_stories
plugins
plugin/plugin_reference
db_migrations
contribute
gates
feature_requests

View File

@ -1,6 +1,7 @@
# The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later.
alembic>=0.8.0 # MIT
Babel>=1.3 # BSD
boto>=2.32.1 # MIT
decorator>=3.4.0 # BSD

View File

@ -31,10 +31,10 @@ class DatabaseFixture(fixture.Config):
def setUp(self):
super(DatabaseFixture, self).setUp()
db_url = os.environ.get("RALLY_UNITTEST_DB_URL", "sqlite://")
db.db_cleanup()
db.engine_reset()
self.conf.set_default("connection", db_url, group="database")
db.db_drop()
db.db_create()
db.schema_cleanup()
db.schema_create()
class TestCase(base.BaseTestCase):