From 84fef2b49a226b0bd2733c1fc862f08d430d6e97 Mon Sep 17 00:00:00 2001 From: Ferdinand Thiessen Date: Sun, 19 Dec 2021 22:22:05 +0100 Subject: [PATCH] feat(db): Add migrations support to plugins --- flaschengeist/plugins/balance/__init__.py | 3 +++ flaschengeist/plugins/pricelist/__init__.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/flaschengeist/plugins/balance/__init__.py b/flaschengeist/plugins/balance/__init__.py index ca61a5f..73841f7 100644 --- a/flaschengeist/plugins/balance/__init__.py +++ b/flaschengeist/plugins/balance/__init__.py @@ -3,6 +3,7 @@ Extends users plugin with balance functions """ +import pathlib from flask import Blueprint, current_app from werkzeug.local import LocalProxy from werkzeug.exceptions import NotFound @@ -67,6 +68,8 @@ class BalancePlugin(Plugin): super(BalancePlugin, self).__init__(config) from . import routes + self.migrations_path = (pathlib.Path(__file__).parent / "migrations").resolve() + @plugins_loaded def post_loaded(*args, **kwargs): if config.get("allow_service_debit", False) and "events" in current_app.config["FG_PLUGINS"]: diff --git a/flaschengeist/plugins/pricelist/__init__.py b/flaschengeist/plugins/pricelist/__init__.py index 168136e..dac2f82 100644 --- a/flaschengeist/plugins/pricelist/__init__.py +++ b/flaschengeist/plugins/pricelist/__init__.py @@ -1,5 +1,6 @@ """Pricelist plugin""" +import pathlib from flask import Blueprint, jsonify, request, current_app from werkzeug.local import LocalProxy from werkzeug.exceptions import BadRequest, Forbidden, NotFound, Unauthorized @@ -24,6 +25,7 @@ class PriceListPlugin(Plugin): def __init__(self, cfg): super().__init__(cfg) + self.migrations_path = (pathlib.Path(__file__).parent / "migrations").resolve() config = {"discount": 0} config.update(cfg)