44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
import logging
|
|
from argparse import ArgumentParser
|
|
|
|
from modules.migrator import migrate_database
|
|
|
|
# from modules.migrator import downgrade_database
|
|
|
|
logging.basicConfig(
|
|
level=logging.INFO,
|
|
format="%(name)s.%(funcName)s | %(levelname)s | %(message)s",
|
|
datefmt="[%X]",
|
|
)
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
parser: ArgumentParser = ArgumentParser(
|
|
prog="Javelina",
|
|
description="Discord bot for community management.",
|
|
)
|
|
|
|
parser.add_argument("--migrate", action="store_true")
|
|
# parser.add_argument("--downgrade", action="store_true")
|
|
parser.add_argument("--confirm", action="store_true")
|
|
|
|
args = parser.parse_args()
|
|
|
|
if args.migrate:
|
|
logger.info("Migrating...")
|
|
migrate_database()
|
|
exit()
|
|
|
|
# if args.downgrade:
|
|
# if not args.confirm:
|
|
# logger.warning(
|
|
# "Argument --downgrade has been provided but this operation may include irreversible changes and destroy existing data in both database and configuration. It's not recommended to do this without backing everything up. Retry this command providing an additional argument --confirm to accept the risks and explicitly execute the downgrade."
|
|
# )
|
|
# exit(1)
|
|
#
|
|
# logger.info("Downgrading...")
|
|
# downgrade_database()
|
|
# exit()
|
|
|
|
logger.info("No arguments have been provided, not doing anything.")
|