cascade process instance delete to message instances w/ burnettk

This commit is contained in:
jasquat 2022-09-22 17:23:30 -04:00
parent 9d855ed8eb
commit d689aad90e
3 changed files with 7 additions and 0 deletions

View File

@ -1,6 +1,8 @@
"""Message_correlation."""
from dataclasses import dataclass
from sqlalchemy.orm import relationship
from flask_bpmn.models.db import db
from flask_bpmn.models.db import SpiffworkflowBaseDBModel
from sqlalchemy import ForeignKey
@ -36,3 +38,5 @@ class MessageCorrelationModel(SpiffworkflowBaseDBModel):
value = db.Column(db.String(255), nullable=False, index=True)
updated_at_in_seconds: int = db.Column(db.Integer)
created_at_in_seconds: int = db.Column(db.Integer)
message_correlations_message_instances = relationship("MessageCorrelationMessageInstanceModel", cascade="delete")

View File

@ -42,6 +42,7 @@ class MessageInstanceModel(SpiffworkflowBaseDBModel):
process_instance_id: int = db.Column(ForeignKey(ProcessInstanceModel.id), nullable=False) # type: ignore
message_model_id: int = db.Column(ForeignKey(MessageModel.id), nullable=False)
message_model = relationship("MessageModel")
message_correlations_message_instances = relationship("MessageCorrelationMessageInstanceModel", cascade="delete")
message_type: str = db.Column(db.String(20), nullable=False)
payload: str = db.Column(db.JSON)

View File

@ -95,6 +95,8 @@ class ProcessInstanceModel(SpiffworkflowBaseDBModel):
active_tasks = relationship("ActiveTaskModel", cascade="delete") # type: ignore
task_events = relationship("TaskEventModel", cascade="delete") # type: ignore
spiff_logs = relationship("SpiffLoggingModel", cascade="delete") # type: ignore
message_instances = relationship("MessageInstanceModel", cascade="delete") # type: ignore
message_correlations = relationship("MessageCorrelationModel", cascade="delete") # type: ignore
bpmn_json: str | None = deferred(db.Column(db.JSON)) # type: ignore
start_in_seconds: int | None = db.Column(db.Integer)