added some timestamp fields to bpmn process tables w/ burnettk
This commit is contained in:
parent
dd5a911049
commit
f3aa94dd8a
|
@ -1,8 +1,8 @@
|
|||
"""empty message
|
||||
|
||||
Revision ID: ede2ae7d3c80
|
||||
Revision ID: 389800c352ee
|
||||
Revises:
|
||||
Create Date: 2023-03-06 11:14:40.739641
|
||||
Create Date: 2023-03-07 10:40:43.709777
|
||||
|
||||
"""
|
||||
from alembic import op
|
||||
|
@ -10,7 +10,7 @@ import sqlalchemy as sa
|
|||
from sqlalchemy.dialects import mysql
|
||||
|
||||
# revision identifiers, used by Alembic.
|
||||
revision = 'ede2ae7d3c80'
|
||||
revision = '389800c352ee'
|
||||
down_revision = None
|
||||
branch_labels = None
|
||||
depends_on = None
|
||||
|
@ -24,6 +24,8 @@ def upgrade():
|
|||
sa.Column('parent_process_id', sa.Integer(), nullable=True),
|
||||
sa.Column('properties_json', sa.JSON(), nullable=False),
|
||||
sa.Column('json_data_hash', sa.String(length=255), nullable=False),
|
||||
sa.Column('start_in_seconds', sa.DECIMAL(precision=17, scale=6), nullable=True),
|
||||
sa.Column('end_in_seconds', sa.DECIMAL(precision=17, scale=6), nullable=True),
|
||||
sa.ForeignKeyConstraint(['parent_process_id'], ['bpmn_process.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
@ -37,6 +39,8 @@ def upgrade():
|
|||
sa.Column('type', sa.String(length=32), nullable=True),
|
||||
sa.Column('bpmn_version_control_type', sa.String(length=50), nullable=True),
|
||||
sa.Column('bpmn_version_control_identifier', sa.String(length=255), nullable=True),
|
||||
sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at_in_seconds', sa.Integer(), nullable=True),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
op.create_index(op.f('ix_bpmn_process_definition_bpmn_identifier'), 'bpmn_process_definition', ['bpmn_identifier'], unique=False)
|
||||
|
@ -210,6 +214,8 @@ def upgrade():
|
|||
sa.Column('state', sa.String(length=10), nullable=False),
|
||||
sa.Column('properties_json', sa.JSON(), nullable=False),
|
||||
sa.Column('json_data_hash', sa.String(length=255), nullable=False),
|
||||
sa.Column('start_in_seconds', sa.DECIMAL(precision=17, scale=6), nullable=True),
|
||||
sa.Column('end_in_seconds', sa.DECIMAL(precision=17, scale=6), nullable=True),
|
||||
sa.ForeignKeyConstraint(['bpmn_process_id'], ['bpmn_process.id'], ),
|
||||
sa.PrimaryKeyConstraint('id')
|
||||
)
|
||||
|
@ -221,6 +227,8 @@ def upgrade():
|
|||
sa.Column('bpmn_identifier', sa.String(length=255), nullable=False),
|
||||
sa.Column('properties_json', sa.JSON(), nullable=False),
|
||||
sa.Column('typename', sa.String(length=255), nullable=False),
|
||||
sa.Column('updated_at_in_seconds', sa.Integer(), nullable=True),
|
||||
sa.Column('created_at_in_seconds', sa.Integer(), nullable=True),
|
||||
sa.ForeignKeyConstraint(['bpmn_process_definition_id'], ['bpmn_process_definition.id'], ),
|
||||
sa.PrimaryKeyConstraint('id'),
|
||||
sa.UniqueConstraint('bpmn_process_definition_id', 'bpmn_identifier', name='task_definition_unique')
|
|
@ -26,3 +26,7 @@ class BpmnProcessModel(SpiffworkflowBaseDBModel):
|
|||
|
||||
# subprocess or top_level_process
|
||||
# process_type: str = db.Column(db.String(30), nullable=False)
|
||||
|
||||
# FIXME: find out how to set this but it'd be cool
|
||||
start_in_seconds: float = db.Column(db.DECIMAL(17, 6))
|
||||
end_in_seconds: float | None = db.Column(db.DECIMAL(17, 6))
|
||||
|
|
|
@ -32,3 +32,6 @@ class BpmnProcessDefinitionModel(SpiffworkflowBaseDBModel):
|
|||
# TODO: remove these from process_instance
|
||||
bpmn_version_control_type: str = db.Column(db.String(50))
|
||||
bpmn_version_control_identifier: str = db.Column(db.String(255))
|
||||
|
||||
updated_at_in_seconds: int = db.Column(db.Integer)
|
||||
created_at_in_seconds: int = db.Column(db.Integer)
|
||||
|
|
|
@ -54,6 +54,9 @@ class TaskModel(SpiffworkflowBaseDBModel):
|
|||
properties_json: dict = db.Column(db.JSON, nullable=False)
|
||||
json_data_hash: str = db.Column(db.String(255), nullable=False, index=True)
|
||||
|
||||
start_in_seconds: float = db.Column(db.DECIMAL(17, 6))
|
||||
end_in_seconds: float | None = db.Column(db.DECIMAL(17, 6))
|
||||
|
||||
|
||||
class Task:
|
||||
"""Task."""
|
||||
|
|
|
@ -30,3 +30,6 @@ class TaskDefinitionModel(SpiffworkflowBaseDBModel):
|
|||
bpmn_identifier: str = db.Column(db.String(255), nullable=False, index=True)
|
||||
properties_json: dict = db.Column(db.JSON, nullable=False)
|
||||
typename: str = db.Column(db.String(255), nullable=False)
|
||||
|
||||
updated_at_in_seconds: int = db.Column(db.Integer)
|
||||
created_at_in_seconds: int = db.Column(db.Integer)
|
||||
|
|
|
@ -1124,6 +1124,9 @@ class ProcessInstanceProcessor:
|
|||
# if self.process_instance_model.bpmn_process_definition_id is None:
|
||||
self._add_bpmn_process_definitions(bpmn_spec_dict)
|
||||
|
||||
# FIXME: Update tasks in the did_complete_task instead to set the final info.
|
||||
# We will need to somehow cache all tasks initially though before each task is run.
|
||||
# Maybe always do this for first run - just need to know it's the first run.
|
||||
subprocesses = process_instance_data_dict.pop("subprocesses")
|
||||
bpmn_process_parent = self._add_bpmn_process(process_instance_data_dict)
|
||||
for subprocess_task_id, subprocess_properties in subprocesses.items():
|
||||
|
|
Loading…
Reference in New Issue