diff options
| author | Abhilash Raj | 2014-09-25 02:53:09 +0530 |
|---|---|---|
| committer | Abhilash Raj | 2014-09-25 02:53:09 +0530 |
| commit | 03647b16eb75cc841bb15c3c48ac5f18f77118b8 (patch) | |
| tree | db79e553c470384046f5d4a130e7f7b9d90eceb7 /src/mailman/commands/cli_migrate.py | |
| parent | 32d118329488df775cd74dad2907ed496022f757 (diff) | |
| download | mailman-03647b16eb75cc841bb15c3c48ac5f18f77118b8.tar.gz mailman-03647b16eb75cc841bb15c3c48ac5f18f77118b8.tar.zst mailman-03647b16eb75cc841bb15c3c48ac5f18f77118b8.zip | |
Diffstat (limited to 'src/mailman/commands/cli_migrate.py')
| -rw-r--r-- | src/mailman/commands/cli_migrate.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mailman/commands/cli_migrate.py b/src/mailman/commands/cli_migrate.py index 6593ea832..85fd07bd4 100644 --- a/src/mailman/commands/cli_migrate.py +++ b/src/mailman/commands/cli_migrate.py @@ -39,13 +39,20 @@ class Migrate: name = 'migrate' - def add(self, parser, comman_parser): + def add(self, parser, command_parser): """See `ICLISubCommand`.""" + command_parser.add_argument( + '-a', '--autogenerate', + action="store_true", help=_("""\ + Autogenerate the migration script using alembic""")) pass def process(self, args): alembic_cfg= Config() alembic_cfg.set_main_option( "script_location", config.alembic['script_location']) - command.upgrade(alembic_cfg, "head") - print("Updated the database schema.") + if args.autogenerate: + command.revision(alembic_cfg, autogenerate=True) + else: + command.upgrade(alembic_cfg, "head") + print("Updated the database schema.") |
