mirror of
https://gitlab.com/KKlochko/tui-rsync.git
synced 2026-09-12 16:37:43 +00:00
Update the models names and id types to uuids.
This commit is contained in:
@@ -1,13 +1,13 @@
|
|||||||
from typing import List
|
from typing import List
|
||||||
from peewee import Model, Database
|
from peewee import Model, Database
|
||||||
from .models import BackupPlan, Destination
|
from .models import BackupPlanModel, DestinationModel
|
||||||
from tui_rsync.core.ports.orm import DatabaseManagerPort
|
from tui_rsync.core.ports.orm import DatabaseManagerPort
|
||||||
|
|
||||||
|
|
||||||
class DatabaseManager(DatabaseManagerPort):
|
class DatabaseManager(DatabaseManagerPort):
|
||||||
models: List[Model] = [
|
models: List[Model] = [
|
||||||
BackupPlan,
|
BackupPlanModel,
|
||||||
Destination,
|
DestinationModel,
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, db: Database):
|
def __init__(self, db: Database):
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ from peewee import *
|
|||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
|
|
||||||
class BackupPlan(Model):
|
class BackupPlanModel(Model):
|
||||||
id = UUIDField(primary_key=True, default=uuid.uuid4)
|
id = UUIDField(primary_key=True, default=uuid.uuid4)
|
||||||
label = CharField()
|
label = CharField()
|
||||||
source = CharField()
|
source = CharField()
|
||||||
@@ -11,6 +11,7 @@ class BackupPlan(Model):
|
|||||||
database = DatabaseProxy()
|
database = DatabaseProxy()
|
||||||
|
|
||||||
|
|
||||||
class Destination(Model):
|
class DestinationModel(Model):
|
||||||
source = ForeignKeyField(BackupPlan, backref='destinations')
|
id = UUIDField(primary_key=True, default=uuid.uuid4)
|
||||||
|
source = ForeignKeyField(BackupPlanModel, backref='destinations')
|
||||||
path = CharField()
|
path = CharField()
|
||||||
|
|||||||
Reference in New Issue
Block a user