From a8de21a077328ca91fa9e2b8b86221bddd7e595e Mon Sep 17 00:00:00 2001 From: Boris Pavlovic Date: Thu, 7 Jan 2016 02:22:16 -0800 Subject: [PATCH] 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 --- .coveragerc | 1 + doc/source/index.rst | 1 + requirements.txt | 1 + tests/unit/test.py | 6 +++--- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.coveragerc b/.coveragerc index f61a0537..302abb04 100644 --- a/.coveragerc +++ b/.coveragerc @@ -5,3 +5,4 @@ source = rally [report] ignore_errors = True precision = 3 +omit = */migrations/versions/ca3626f62937_init_migration.py diff --git a/doc/source/index.rst b/doc/source/index.rst index e6602484..f3617748 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -33,6 +33,7 @@ Contents user_stories plugins plugin/plugin_reference + db_migrations contribute gates feature_requests diff --git a/requirements.txt b/requirements.txt index 91ce49ec..af50a089 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/tests/unit/test.py b/tests/unit/test.py index b48a69fb..b2d7c9b5 100644 --- a/tests/unit/test.py +++ b/tests/unit/test.py @@ -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):