longer column and update script

This commit is contained in:
burnettk 2022-09-16 18:39:00 -04:00
parent 46a0c02e96
commit 19a3d3b27b
3 changed files with 41 additions and 38 deletions

View File

@ -26,8 +26,6 @@ def main():
files = SpecFileService.get_files( files = SpecFileService.get_files(
process_model, extension_filter="bpmn" process_model, extension_filter="bpmn"
) )
if len(files) == 1:
# print(f"primary_file_name: {process_model.primary_file_name}")
bpmn_xml_file_contents = SpecFileService.get_data( bpmn_xml_file_contents = SpecFileService.get_data(
process_model, process_model.primary_file_name process_model, process_model.primary_file_name
) )
@ -36,30 +34,35 @@ def main():
bpmn_xml_file_contents, process_model.primary_file_name bpmn_xml_file_contents, process_model.primary_file_name
) )
) )
try: bad_files = ['B.1.0.bpmn', 'C.1.0.bpmn', 'C.2.0.bpmn', 'C.6.0.bpmn', 'TC-5.1.bpmn']
new_bpmn_process_identifier = ( if process_model.primary_file_name in bad_files:
SpecFileService.get_bpmn_process_identifier( continue
bpmn_etree_element print(f"primary_file_name: {process_model.primary_file_name}")
) SpecFileService.update_file(process_model, process_model.primary_file_name, bpmn_xml_file_contents)
) # if len(files) == 1:
if ( # try:
process_model.primary_process_id # new_bpmn_process_identifier = (
!= new_bpmn_process_identifier # SpecFileService.get_bpmn_process_identifier(
): # bpmn_etree_element
print(
"primary_process_id: ", process_model.primary_process_id
)
# attributes_to_update = {
# "primary_process_id": new_bpmn_process_identifier
# }
# ProcessModelService().update_spec(
# process_model, attributes_to_update
# ) # )
# SpecFileService.update_file(process_model, process_model.primary_file_name, bpmn_xml_file_contents) # )
# except Exception as exception: # if (
except Exception: # process_model.primary_process_id
print(f"BAD ONE: {process_model.id}") # != new_bpmn_process_identifier
# raise exception # ):
# print(
# "primary_process_id: ", process_model.primary_process_id
# )
# # attributes_to_update = {
# # "primary_process_id": new_bpmn_process_identifier
# # }
# # ProcessModelService().update_spec(
# # process_model, attributes_to_update
# # )
# # except Exception as exception:
# except Exception:
# print(f"BAD ONE: {process_model.id}")
# # raise exception
else: else:
no_primary.append(process_model) no_primary.append(process_model)
# for bpmn in no_primary: # for bpmn in no_primary:

View File

@ -1,8 +1,8 @@
"""empty message """empty message
Revision ID: 6d3ffcc6849e Revision ID: eadaa0914e7a
Revises: Revises:
Create Date: 2022-09-16 18:20:43.082949 Create Date: 2022-09-16 18:32:44.599837
""" """
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 = '6d3ffcc6849e' revision = 'eadaa0914e7a'
down_revision = None down_revision = None
branch_labels = None branch_labels = None
depends_on = None depends_on = None
@ -27,7 +27,7 @@ def upgrade():
) )
op.create_table('bpmn_process_id_lookup', op.create_table('bpmn_process_id_lookup',
sa.Column('id', sa.Integer(), nullable=False), sa.Column('id', sa.Integer(), nullable=False),
sa.Column('bpmn_process_identifier', sa.String(length=50), nullable=True), sa.Column('bpmn_process_identifier', sa.String(length=255), nullable=True),
sa.Column('bpmn_file_relative_path', sa.String(length=255), nullable=True), sa.Column('bpmn_file_relative_path', sa.String(length=255), nullable=True),
sa.PrimaryKeyConstraint('id') sa.PrimaryKeyConstraint('id')
) )

View File

@ -9,5 +9,5 @@ class BpmnProcessIdLookup(SpiffworkflowBaseDBModel):
__tablename__ = "bpmn_process_id_lookup" __tablename__ = "bpmn_process_id_lookup"
id = db.Column(db.Integer, primary_key=True) id = db.Column(db.Integer, primary_key=True)
bpmn_process_identifier = db.Column(db.String(50), unique=True, index=True) bpmn_process_identifier = db.Column(db.String(255), unique=True, index=True)
bpmn_file_relative_path = db.Column(db.String(255)) bpmn_file_relative_path = db.Column(db.String(255))