Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ packages = ["xpartamupp"]
echelon = "xpartamupp.echelon:main"
echelon-db = "xpartamupp.lobby_ranking:main"
modbot = "xpartamupp.modbot:main"
modbot-db = "xpartamupp.lobby_moderation_db:main"
xpartamupp = "xpartamupp.xpartamupp:main"

[tool.ruff]
Expand Down
11 changes: 10 additions & 1 deletion xpartamupp/lobby_moderation_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ def parse_args():
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description="Helper command for database creation",
)
parser.add_argument("action", help="Action to apply to the database", choices=["create"])
parser.add_argument(
"action", help="Action to apply to the database", choices=["create", "schema"]
)
parser.add_argument(
"--database-url",
help="URL for the moderation database",
Expand All @@ -242,6 +244,13 @@ def main():
engine = create_engine(args.database_url)
if args.action == "create":
Base.metadata.create_all(engine)
elif args.action == "schema":
engine = create_engine(
"sqlite://",
strategy="mock",
executor=lambda sql, _: print(sql.compile(dialect=engine.dialect)), # noqa: T201
)
Base.metadata.create_all(engine, checkfirst=False)


if __name__ == "__main__":
Expand Down
11 changes: 10 additions & 1 deletion xpartamupp/lobby_ranking.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ def parse_args():
formatter_class=argparse.ArgumentDefaultsHelpFormatter,
description="Helper command for database creation",
)
parser.add_argument("action", help="Action to apply to the database", choices=["create"])
parser.add_argument(
"action", help="Action to apply to the database", choices=["create", "schema"]
)
parser.add_argument(
"--database-url",
help="URL for the leaderboard database",
Expand All @@ -173,6 +175,13 @@ def main():
engine = create_engine(args.database_url)
if args.action == "create":
Base.metadata.create_all(engine)
elif args.action == "schema":
engine = create_engine(
"sqlite://",
strategy="mock",
executor=lambda sql, _: print(sql.compile(dialect=engine.dialect)), # noqa: T201
)
Base.metadata.create_all(engine, checkfirst=False)


if __name__ == "__main__":
Expand Down
Loading