From 6ad6ca2b657bf2649fc4a45d670a3c43e4d55c2e Mon Sep 17 00:00:00 2001 From: Juan Antonio Osorio Robles Date: Wed, 28 Jan 2015 23:08:16 +0200 Subject: [PATCH] Remove unnecessary checks from migration commands When doing the alembic setup to enable the usage of the commands API, there were some unnecessary checks in each command to verify that the alembic configuration isn't a falsey value. Although, there is no scenario where this could happen, since proper exceptions are thrown. So this fixes that. Change-Id: Ibc1b2ebefd13d7569e1ff69de873cfc557804a76 --- barbican/model/migration/commands.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/barbican/model/migration/commands.py b/barbican/model/migration/commands.py index 08b97ccd9..b30063610 100644 --- a/barbican/model/migration/commands.py +++ b/barbican/model/migration/commands.py @@ -64,39 +64,33 @@ def init_config(sql_url=None): def upgrade(to_version='head', sql_url=None): """Upgrade to the specified version.""" alembic_cfg = init_config(sql_url) - if alembic_cfg: - alembic_command.upgrade(alembic_cfg, to_version) + alembic_command.upgrade(alembic_cfg, to_version) def downgrade(to_version, sql_url=None): """Downgrade to the specified version.""" alembic_cfg = init_config(sql_url) - if alembic_cfg: - alembic_command.downgrade(alembic_cfg, to_version) + alembic_command.downgrade(alembic_cfg, to_version) def history(verbose, sql_url=None): alembic_cfg = init_config(sql_url) - if alembic_cfg: - alembic_command.history(alembic_cfg, verbose=verbose) + alembic_command.history(alembic_cfg, verbose=verbose) def current(verbose, sql_url=None): alembic_cfg = init_config(sql_url) - if alembic_cfg: - alembic_command.current(alembic_cfg, verbose=verbose) + alembic_command.current(alembic_cfg, verbose=verbose) def stamp(to_version='head', sql_url=None): """Stamp the specified version, with no migration performed.""" alembic_cfg = init_config(sql_url) - if alembic_cfg: - alembic_command.stamp(alembic_cfg, to_version) + alembic_command.stamp(alembic_cfg, to_version) def generate(autogenerate=True, message='generate changes', sql_url=None): """Generate a version file.""" alembic_cfg = init_config(sql_url) - if alembic_cfg: - alembic_command.revision(alembic_cfg, message=message, - autogenerate=autogenerate) + alembic_command.revision(alembic_cfg, message=message, + autogenerate=autogenerate)