Add create-db command

This commit is contained in:
2026-01-12 03:16:25 +09:00
parent ce633fe9b9
commit 1a702c454a
2 changed files with 10 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
from worblehat.models import Base
import logging
from pprint import pformat
@@ -67,6 +68,11 @@ def main():
WorblehatCli.run_with_safe_exit_wrapper(sql_session)
exit(0)
if args.command == "create-db":
database_url = Config.db_string()
engine = create_engine(database_url)
Base.metadata.create_all(engine)
if args.command == "devscripts":
sql_session = _connect_to_database(echo=Config["logging.debug_sql"])
if args.script == "seed-content-for-deadline-daemon":

View File

@@ -19,6 +19,10 @@ subparsers.add_parser(
"deadline-daemon",
help="Initialize a single pass of the daemon which sends deadline emails",
)
subparsers.add_parser(
"create-db",
help="Create the database schema in the database specified in the configuration",
)
subparsers.add_parser(
"cli",
help="Start the command line interface",