def setUp(self): super(DatabaseFixture, self).setUp() db_url = os.environ.get("RALLY_UNITTEST_DB_URL", "sqlite://") db.engine_reset() self.conf.set_default("connection", db_url, group="database") db.schema_cleanup() db.schema_create()
def recreate(self): """Drop and create Rally database. This will delete all existing data. """ db.schema_cleanup() db.schema_create() envutils.clear_env()
def setUp(self): # we change DB metadata in tests so we reload # models to refresh the metadata to it's original state six.moves.reload_module(rally.common.db.sqlalchemy.models) super(MigrationTestCase, self).setUp() self.alembic_config = api._alembic_config() self.engine = api.get_engine() # remove everything from DB and stamp it as 'base' # so that migration (i.e. upgrade up to 'head') # will actually take place db.schema_cleanup() db.schema_stamp("base")
def recreate(self, api): """Drop and create Rally database. This will delete all existing data. """ print("Recreating database: ", end="") self.show(api, True) db.schema_cleanup() print("Database deleted successfully") db.schema_create() print("Database created successfully") envutils.clear_env()