remove column

This commit is contained in:
burnettk 2022-11-24 12:28:53 -05:00
parent 10d8156972
commit 37fcc547f7
5 changed files with 22 additions and 14 deletions

View File

@ -1,3 +1,5 @@
from __future__ import with_statement
import logging
from logging.config import fileConfig

View File

@ -1,8 +1,8 @@
"""empty message
Revision ID: 37079935891c
Revision ID: 568f5fe2c9f8
Revises:
Create Date: 2022-11-24 11:44:47.149204
Create Date: 2022-11-24 12:11:46.669020
"""
from alembic import op
@ -10,7 +10,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '37079935891c'
revision = '568f5fe2c9f8'
down_revision = None
branch_labels = None
depends_on = None
@ -119,7 +119,6 @@ def upgrade():
sa.Column('id', sa.Integer(), nullable=False),
sa.Column('process_model_identifier', sa.String(length=255), nullable=False),
sa.Column('process_model_display_name', sa.String(length=255), nullable=False),
sa.Column('process_group_identifier', sa.String(length=50), nullable=False),
sa.Column('process_initiator_id', sa.Integer(), nullable=False),
sa.Column('bpmn_json', sa.JSON(), nullable=True),
sa.Column('start_in_seconds', sa.Integer(), nullable=True),
@ -133,7 +132,6 @@ def upgrade():
sa.ForeignKeyConstraint(['process_initiator_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('id')
)
op.create_index(op.f('ix_process_instance_process_group_identifier'), 'process_instance', ['process_group_identifier'], unique=False)
op.create_index(op.f('ix_process_instance_process_model_display_name'), 'process_instance', ['process_model_display_name'], unique=False)
op.create_index(op.f('ix_process_instance_process_model_identifier'), 'process_instance', ['process_model_identifier'], unique=False)
op.create_table('process_instance_report',
@ -301,7 +299,6 @@ def downgrade():
op.drop_table('process_instance_report')
op.drop_index(op.f('ix_process_instance_process_model_identifier'), table_name='process_instance')
op.drop_index(op.f('ix_process_instance_process_model_display_name'), table_name='process_instance')
op.drop_index(op.f('ix_process_instance_process_group_identifier'), table_name='process_instance')
op.drop_table('process_instance')
op.drop_table('principal')
op.drop_index(op.f('ix_message_triggerable_process_model_process_model_identifier'), table_name='message_triggerable_process_model')

View File

@ -75,7 +75,6 @@ class ProcessInstanceModel(SpiffworkflowBaseDBModel):
process_model_display_name: str = db.Column(
db.String(255), nullable=False, index=True
)
process_group_identifier: str = db.Column(db.String(50), nullable=False, index=True)
process_initiator_id: int = db.Column(ForeignKey(UserModel.id), nullable=False)
process_initiator = relationship("UserModel")
@ -104,7 +103,7 @@ class ProcessInstanceModel(SpiffworkflowBaseDBModel):
return {
"id": self.id,
"process_model_identifier": self.process_model_identifier,
"process_group_identifier": self.process_group_identifier,
"process_model_display_name": self.process_model_display_name,
"status": self.status,
"start_in_seconds": self.start_in_seconds,
"end_in_seconds": self.end_in_seconds,
@ -141,7 +140,7 @@ class ProcessInstanceModelSchema(Schema):
fields = [
"id",
"process_model_identifier",
"process_group_identifier",
"process_model_display_name",
"process_initiator_id",
"start_in_seconds",
"end_in_seconds",
@ -193,6 +192,7 @@ class ProcessInstanceApiSchema(Schema):
"status",
"next_task",
"process_model_identifier",
"process_model_display_name",
"completed_tasks",
"updated_at_in_seconds",
]
@ -211,6 +211,7 @@ class ProcessInstanceApiSchema(Schema):
"status",
"next_task",
"process_model_identifier",
"process_model_display_name",
"completed_tasks",
"updated_at_in_seconds",
]

View File

@ -158,12 +158,12 @@ class ProcessModelService(FileSystemService):
os.path.join(FileSystemService.root_path(), process_model_id)
)
if cls.is_model(model_path):
process_model = self.get_process_model_from_relative_path(process_model_id)
return process_model
return cls.get_process_model_from_relative_path(process_model_id)
raise ProcessEntityNotFoundError("process_model_not_found")
@classmethod
def get_process_models(
self,
cls,
process_group_id: Optional[str] = None,
recursive: Optional[bool] = False,
filter_runnable_by_user: Optional[bool] = False,
@ -183,7 +183,7 @@ class ProcessModelService(FileSystemService):
process_model_relative_path = os.path.relpath(
file, start=FileSystemService.root_path()
)
process_model = self.get_process_model_from_relative_path(
process_model = cls.get_process_model_from_relative_path(
os.path.dirname(process_model_relative_path)
)
process_models.append(process_model)

View File

@ -252,6 +252,14 @@ class BaseTest:
There must be an existing process model to instantiate.
"""
if not ProcessModelService.is_model(test_process_model_id):
import pdb; pdb.set_trace()
basename = os.path.basename(test_process_model_id)
load_test_spec(
process_model_id=test_process_model_id,
process_model_source_directory=basename,
bpmn_file_name=basename
)
modified_process_model_id = test_process_model_id.replace("/", ":")
response = client.post(
f"/v1.0/process-models/{modified_process_model_id}/process-instances",
@ -283,7 +291,7 @@ class BaseTest:
status=status,
process_initiator=user,
process_model_identifier=process_model.id,
process_group_identifier="",
process_model_display_name=process_model.display_name,
updated_at_in_seconds=round(time.time()),
start_in_seconds=current_time - (3600 * 1),
end_in_seconds=current_time - (3600 * 1 - 20),