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,40 +26,43 @@ def main():
files = SpecFileService.get_files(
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(
process_model, process_model.primary_file_name
bpmn_xml_file_contents = SpecFileService.get_data(
process_model, process_model.primary_file_name
)
bpmn_etree_element: EtreeElement = (
SpecFileService.get_etree_element_from_binary_data(
bpmn_xml_file_contents, process_model.primary_file_name
)
bpmn_etree_element: EtreeElement = (
SpecFileService.get_etree_element_from_binary_data(
bpmn_xml_file_contents, process_model.primary_file_name
)
)
try:
new_bpmn_process_identifier = (
SpecFileService.get_bpmn_process_identifier(
bpmn_etree_element
)
)
if (
process_model.primary_process_id
!= new_bpmn_process_identifier
):
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:
except Exception:
print(f"BAD ONE: {process_model.id}")
# raise exception
)
bad_files = ['B.1.0.bpmn', 'C.1.0.bpmn', 'C.2.0.bpmn', 'C.6.0.bpmn', 'TC-5.1.bpmn']
if process_model.primary_file_name in bad_files:
continue
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:
# try:
# new_bpmn_process_identifier = (
# SpecFileService.get_bpmn_process_identifier(
# bpmn_etree_element
# )
# )
# if (
# process_model.primary_process_id
# != new_bpmn_process_identifier
# ):
# 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:
no_primary.append(process_model)
# for bpmn in no_primary:

View File

@ -1,8 +1,8 @@
"""empty message
Revision ID: 6d3ffcc6849e
Revision ID: eadaa0914e7a
Revises:
Create Date: 2022-09-16 18:20:43.082949
Create Date: 2022-09-16 18:32:44.599837
"""
from alembic import op
@ -10,7 +10,7 @@ import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6d3ffcc6849e'
revision = 'eadaa0914e7a'
down_revision = None
branch_labels = None
depends_on = None
@ -27,7 +27,7 @@ def upgrade():
)
op.create_table('bpmn_process_id_lookup',
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.PrimaryKeyConstraint('id')
)

View File

@ -9,5 +9,5 @@ class BpmnProcessIdLookup(SpiffworkflowBaseDBModel):
__tablename__ = "bpmn_process_id_lookup"
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))