From 2c0e64cf2282499ba8fac7955e66cd3e6773d541 Mon Sep 17 00:00:00 2001 From: Hironsan Date: Mon, 21 Feb 2022 14:49:14 +0900 Subject: [PATCH] Add migrate command to cli --- backend/cli.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/backend/cli.py b/backend/cli.py index 6d358f10..3eeb5cb4 100644 --- a/backend/cli.py +++ b/backend/cli.py @@ -70,6 +70,11 @@ def command_user_create(args): ) +def command_migrate(args): + print("Start migration.") + management.call_command("migrate") + + def command_run_webserver(args): print(f"Starting server with port {args.port}.") if is_windows(): @@ -102,9 +107,12 @@ def main(): # Create a parser for db initialization. parser_init = subparsers.add_parser("init", help="see `init -h`") - parser_init.set_defaults(handler=command_db_init) + # Create a parser for migration. + parser_migration = subparsers.add_parser("migrate", help="Updates database schema.") + parser_migration.set_defaults(handler=command_migrate) + # Create a parser for user creation. parser_create_user = subparsers.add_parser("createuser", help="see `createuser -h`") parser_create_user.add_argument("--username", type=str, default="admin", help="admin username")