#!/usr/bin/python3
import logging

from mini_buildd import cli, webapp

LOG = logging.getLogger("mini_buildd")

#: Needed for man page hack in setup.py
DESCRIPTION = "Run django database migrations on given database file"


class CLI(cli.CLI):
    def __init__(self):
        super().__init__("run-migrations", DESCRIPTION)
        self.parser.add_argument("sqlite_path", action="store")

    def runcli(self):
        webapp.pseudo_configure(self.args.sqlite_path)
        webapp.migrate()


if __name__ == "__main__":
    CLI().run()
