diff options
Diffstat (limited to 'src/mailman/commands/cli_migrate.py')
| -rw-r--r-- | src/mailman/commands/cli_migrate.py | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/src/mailman/commands/cli_migrate.py b/src/mailman/commands/cli_migrate.py index 85fd07bd4..82bf4a708 100644 --- a/src/mailman/commands/cli_migrate.py +++ b/src/mailman/commands/cli_migrate.py @@ -22,20 +22,23 @@ from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ 'Migrate', -] + ] + from alembic import command -from alembic.config import Config from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ +from mailman.database.alembic import alembic_cfg from mailman.interfaces.command import ICLISubCommand +from mailman.utilities.modules import expand_path + @implementer(ICLISubCommand) class Migrate: - """Migrate the mailman database to the schema.""" + """Migrate the Mailman database to the latest schema.""" name = 'migrate' @@ -43,16 +46,17 @@ class Migrate: """See `ICLISubCommand`.""" command_parser.add_argument( '-a', '--autogenerate', - action="store_true", help=_("""\ - Autogenerate the migration script using alembic""")) - pass + action='store_true', help=_("""\ + Autogenerate the migration script using Alembic.""")) + command_parser.add_argument( + '-q', '--quiet', + action='store_true', default=False, + help=('Produce less output.')) def process(self, args): - alembic_cfg= Config() - alembic_cfg.set_main_option( - "script_location", config.alembic['script_location']) if args.autogenerate: command.revision(alembic_cfg, autogenerate=True) else: - command.upgrade(alembic_cfg, "head") - print("Updated the database schema.") + command.upgrade(alembic_cfg, 'head') + if not args.quiet: + print('Updated the database schema.') |
