def action_db_migrate(action=('a', 'start'), debug=False): """Migrate database. This command is responsible for data base migrations. Actions: init - initiates migration module use only once. migrate - creates schema migration. upgrade - upgrades database using schema migrations. Options: - '--debug' use debug configuration """ from flask.ext.migrate import upgrade, init, migrate, stamp, downgrade if debug: app = make_debug(with_debug_layer=False) else: app = make_app() with app.app_context(): if action == 'init': init() elif action == 'migrate': migrate() elif action == 'upgrade': upgrade() elif action == 'stamp': stamp() elif action == 'downgrade': downgrade() else: print('Unknown action')
def action_send_rate_reminder(debug=False): """ This command is responsible for sending every one who ate an e-mail that they did not rated the meal on current day at 14:00 Options: - '--debug' use debug configuration """ from .utils import send_rate_reminder if debug: app = make_debug(with_debug_layer=False) else: app = make_app() with app.app_context(): send_rate_reminder()
def action_unblock_ordering(debug=False): """ This command is responsible for blocking or unblocking the ability to create new orders. Use on 00:01 every day. Options: - '--debug' use debug configuration """ from .utils import change_ordering_status if debug: app = make_debug(with_debug_layer=False) else: app = make_app() with app.app_context(): change_ordering_status(True)
def action_add_koziolek(debug=False): """ This command is responsible for adding meal of a day from pod koziolek. use in the morning from Monday to Friday. Options: - '--debug' use debug configuration """ from .utils import add_daily_koziolek if debug: app = make_debug(with_debug_layer=False) else: app = make_app() with app.app_context(): add_daily_koziolek()
def action_add_tomas(debug=False): """ This command is responsible for adding week menu from Tomas. use only on MONDAYS ! Options: - '--debug' use debug configuration """ from .utils import get_week_from_tomas if debug: app = make_debug(with_debug_layer=False) else: app = make_app() with app.app_context(): get_week_from_tomas()
def action_send_daily_reminder(debug=False): """ This command is responsible for sending every one an reminding e-mail that they did not ordered on current day at 10:45 Options: - '--debug' use debug configuration """ from .utils import send_daily_reminder if debug: app = make_debug(with_debug_layer=False) else: app = make_app() with app.app_context(): send_daily_reminder()