关联关系

This commit is contained in:
2022-04-15 14:49:39 +08:00
parent e72eeb1f0e
commit 900b1bd614
3 changed files with 6 additions and 18 deletions

View File

@ -1,6 +1,9 @@
import os
from typing import TYPE_CHECKING
from . import db
if TYPE_CHECKING:
from .Workflow import Workflow
class DanmakuClip(db.Model):
@ -9,7 +12,7 @@ class DanmakuClip(db.Model):
file = db.Column(db.String(255))
offset = db.Column(db.Float, nullable=False, default=0)
workflow_id = db.Column(db.Integer, db.ForeignKey('workflow.id'))
workflow = db.relationship("Workflow", backref=db.backref("danmaku_clips", lazy="dynamic"))
workflow: "Workflow" = db.relationship("Workflow", uselist=False, backref=db.backref("danmaku_clips"))
@property
def full_path(self):