diff options
| author | Abhilash Raj | 2014-10-02 20:16:00 +0530 |
|---|---|---|
| committer | Abhilash Raj | 2014-10-02 20:16:00 +0530 |
| commit | 6d4af22c8ee51e1b097ec0370cadd3f5a6b95c08 (patch) | |
| tree | 2f5a8b9723f670bdc4179f7dbdbb0322ab966fd9 /src/mailman/commands/cli_migrate.py | |
| parent | 556631243a206f1680d6737227c34e2d66d85748 (diff) | |
| parent | 5166ae93e5c51285661f4ac251c0d4b9390fe785 (diff) | |
| download | mailman-6d4af22c8ee51e1b097ec0370cadd3f5a6b95c08.tar.gz mailman-6d4af22c8ee51e1b097ec0370cadd3f5a6b95c08.tar.zst mailman-6d4af22c8ee51e1b097ec0370cadd3f5a6b95c08.zip | |
Diffstat (limited to 'src/mailman/commands/cli_migrate.py')
| -rw-r--r-- | src/mailman/commands/cli_migrate.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/src/mailman/commands/cli_migrate.py b/src/mailman/commands/cli_migrate.py index 85fd07bd4..ca9d5e9d4 100644 --- a/src/mailman/commands/cli_migrate.py +++ b/src/mailman/commands/cli_migrate.py @@ -22,7 +22,8 @@ from __future__ import absolute_import, print_function, unicode_literals __metaclass__ = type __all__ = [ 'Migrate', -] + ] + from alembic import command from alembic.config import Config @@ -31,11 +32,13 @@ from zope.interface import implementer from mailman.config import config from mailman.core.i18n import _ 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,20 @@ 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 = Config() alembic_cfg.set_main_option( - "script_location", config.alembic['script_location']) + 'script_location', expand_path(config.database['alembic_scripts'])) 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.') |
