feat(db): Add migrations support to plugins
This commit is contained in:
parent
8792a0eae6
commit
f787d19747
|
@ -3,6 +3,7 @@
|
||||||
Extends users plugin with balance functions
|
Extends users plugin with balance functions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
import pathlib
|
||||||
from flask import Blueprint, current_app
|
from flask import Blueprint, current_app
|
||||||
from werkzeug.local import LocalProxy
|
from werkzeug.local import LocalProxy
|
||||||
from werkzeug.exceptions import NotFound
|
from werkzeug.exceptions import NotFound
|
||||||
|
@ -67,6 +68,8 @@ class BalancePlugin(Plugin):
|
||||||
super(BalancePlugin, self).__init__(config)
|
super(BalancePlugin, self).__init__(config)
|
||||||
from . import routes
|
from . import routes
|
||||||
|
|
||||||
|
self.migrations_path = (pathlib.Path(__file__).parent / "migrations").resolve()
|
||||||
|
|
||||||
@plugins_loaded
|
@plugins_loaded
|
||||||
def post_loaded(*args, **kwargs):
|
def post_loaded(*args, **kwargs):
|
||||||
if config.get("allow_service_debit", False) and "events" in current_app.config["FG_PLUGINS"]:
|
if config.get("allow_service_debit", False) and "events" in current_app.config["FG_PLUGINS"]:
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
"""Pricelist plugin"""
|
"""Pricelist plugin"""
|
||||||
|
|
||||||
|
import pathlib
|
||||||
from flask import Blueprint, jsonify, request, current_app
|
from flask import Blueprint, jsonify, request, current_app
|
||||||
from werkzeug.local import LocalProxy
|
from werkzeug.local import LocalProxy
|
||||||
from werkzeug.exceptions import BadRequest, Forbidden, NotFound, Unauthorized
|
from werkzeug.exceptions import BadRequest, Forbidden, NotFound, Unauthorized
|
||||||
|
@ -24,6 +25,7 @@ class PriceListPlugin(Plugin):
|
||||||
|
|
||||||
def __init__(self, cfg):
|
def __init__(self, cfg):
|
||||||
super().__init__(cfg)
|
super().__init__(cfg)
|
||||||
|
self.migrations_path = (pathlib.Path(__file__).parent / "migrations").resolve()
|
||||||
config = {"discount": 0}
|
config = {"discount": 0}
|
||||||
config.update(cfg)
|
config.update(cfg)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue