remove column

This commit is contained in:
burnettk 2022-11-24 12:28:53 -05:00
parent 2eb3ef6aa3
commit 2c751a7825
5 changed files with 22 additions and 14 deletions

View File

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

View File

@ -1,8 +1,8 @@
"""empty message """empty message
Revision ID: 37079935891c Revision ID: 568f5fe2c9f8
Revises: Revises:
Create Date: 2022-11-24 11:44:47.149204 Create Date: 2022-11-24 12:11:46.669020
""" """
from alembic import op from alembic import op
@ -10,7 +10,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic. # revision identifiers, used by Alembic.
revision = '37079935891c' revision = '568f5fe2c9f8'
down_revision = None down_revision = None
branch_labels = None branch_labels = None
depends_on = None depends_on = None
@ -119,7 +119,6 @@ def upgrade():
sa.Column('id', sa.Integer(), nullable=False), sa.Column('id', sa.Integer(), nullable=False),
sa.Column('process_model_identifier', sa.String(length=255), 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_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('process_initiator_id', sa.Integer(), nullable=False),
sa.Column('bpmn_json', sa.JSON(), nullable=True), sa.Column('bpmn_json', sa.JSON(), nullable=True),
sa.Column('start_in_seconds', sa.Integer(), 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.ForeignKeyConstraint(['process_initiator_id'], ['user.id'], ),
sa.PrimaryKeyConstraint('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_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_index(op.f('ix_process_instance_process_model_identifier'), 'process_instance', ['process_model_identifier'], unique=False)
op.create_table('process_instance_report', op.create_table('process_instance_report',
@ -301,7 +299,6 @@ def downgrade():
op.drop_table('process_instance_report') 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_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_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('process_instance')
op.drop_table('principal') op.drop_table('principal')
op.drop_index(op.f('ix_message_triggerable_process_model_process_model_identifier'), table_name='message_triggerable_process_model') 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( process_model_display_name: str = db.Column(
db.String(255), nullable=False, index=True 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_id: int = db.Column(ForeignKey(UserModel.id), nullable=False)
process_initiator = relationship("UserModel") process_initiator = relationship("UserModel")
@ -104,7 +103,7 @@ class ProcessInstanceModel(SpiffworkflowBaseDBModel):
return { return {
"id": self.id, "id": self.id,
"process_model_identifier": self.process_model_identifier, "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, "status": self.status,
"start_in_seconds": self.start_in_seconds, "start_in_seconds": self.start_in_seconds,
"end_in_seconds": self.end_in_seconds, "end_in_seconds": self.end_in_seconds,
@ -141,7 +140,7 @@ class ProcessInstanceModelSchema(Schema):
fields = [ fields = [
"id", "id",
"process_model_identifier", "process_model_identifier",
"process_group_identifier", "process_model_display_name",
"process_initiator_id", "process_initiator_id",
"start_in_seconds", "start_in_seconds",
"end_in_seconds", "end_in_seconds",
@ -193,6 +192,7 @@ class ProcessInstanceApiSchema(Schema):
"status", "status",
"next_task", "next_task",
"process_model_identifier", "process_model_identifier",
"process_model_display_name",
"completed_tasks", "completed_tasks",
"updated_at_in_seconds", "updated_at_in_seconds",
] ]
@ -211,6 +211,7 @@ class ProcessInstanceApiSchema(Schema):
"status", "status",
"next_task", "next_task",
"process_model_identifier", "process_model_identifier",
"process_model_display_name",
"completed_tasks", "completed_tasks",
"updated_at_in_seconds", "updated_at_in_seconds",
] ]

View File

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

View File

@ -252,6 +252,14 @@ class BaseTest:
There must be an existing process model to instantiate. 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("/", ":") modified_process_model_id = test_process_model_id.replace("/", ":")
response = client.post( response = client.post(
f"/v1.0/process-models/{modified_process_model_id}/process-instances", f"/v1.0/process-models/{modified_process_model_id}/process-instances",
@ -283,7 +291,7 @@ class BaseTest:
status=status, status=status,
process_initiator=user, process_initiator=user,
process_model_identifier=process_model.id, process_model_identifier=process_model.id,
process_group_identifier="", process_model_display_name=process_model.display_name,
updated_at_in_seconds=round(time.time()), updated_at_in_seconds=round(time.time()),
start_in_seconds=current_time - (3600 * 1), start_in_seconds=current_time - (3600 * 1),
end_in_seconds=current_time - (3600 * 1 - 20), end_in_seconds=current_time - (3600 * 1 - 20),