projects
/
osm
/
MON.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Adds migration engine for peewee ORM
[osm/MON.git]
/
osm_mon
/
core
/
database.py
diff --git
a/osm_mon/core/database.py
b/osm_mon/core/database.py
index
eca08e9
..
0886c2b
100644
(file)
--- a/
osm_mon/core/database.py
+++ b/
osm_mon/core/database.py
@@
-23,11
+23,14
@@
##
import logging
##
import logging
+import os
import uuid
from peewee import CharField, TextField, FloatField, Model, AutoField, Proxy
import uuid
from peewee import CharField, TextField, FloatField, Model, AutoField, Proxy
+from peewee_migrate import Router
from playhouse.db_url import connect
from playhouse.db_url import connect
+from osm_mon import migrations
from osm_mon.core.config import Config
log = logging.getLogger(__name__)
from osm_mon.core.config import Config
log = logging.getLogger(__name__)
@@
-72,7
+75,8
@@
class DatabaseManager:
def create_tables(self) -> None:
with db.atomic():
def create_tables(self) -> None:
with db.atomic():
- db.create_tables([VimCredentials, Alarm])
+ router = Router(db, os.path.dirname(migrations.__file__))
+ router.run()
def get_credentials(self, vim_uuid: str = None) -> VimCredentials:
with db.atomic():
def get_credentials(self, vim_uuid: str = None) -> VimCredentials:
with db.atomic():