Browse Source
Merge pull request #1698 from doccano/feature/migrateCommand
Add migrate command to cli
pull/1699/head
Hiroki Nakayama
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
9 additions and
1 deletions
-
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") |
|
|
|