feat(db): Add migrations support to plugins

This commit is contained in:
Ferdinand Thiessen 2021-12-19 22:22:05 +01:00
parent 6ae0bdc3d9
commit e34dc5dd62
3 changed files with 6 additions and 1 deletions

View File

@ -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"]:

View File

@ -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)