def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text( "update workflow set specification = :spec where id = :id") for workflow in connection.execute(fetch_workflows): if not workflow.specification: continue specification = Yaml.unserialize(workflow.specification) if not specification or 'schema' not in specification: continue try: query = specification['schema']['structure']['infoset']['source'][ 'query'] except: continue if query == old_query: specification['schema']['structure']['infoset']['source'][ 'query'] = new_query specification = Yaml.serialize(specification) connection.execute(update_workflows, spec=specification, id=workflow.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text("update workflow set specification = :spec where id = :id") for wf in connection.execute(fetch_workflows): yaml_dict = Yaml.unserialize(wf.specification) if yaml_dict.get('form', IncorrectFormDict) == IncorrectFormDict: yaml_dict['form'] = CorrectedFormDict specification = Yaml.serialize(yaml_dict) connection.execute(update_workflows, spec=specification, id=wf.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text( "update workflow set specification = :spec where id = :id") for wf in connection.execute(fetch_workflows): yaml_dict = Yaml.unserialize(wf.specification) if yaml_dict.get('form', IncorrectFormDict) == IncorrectFormDict: yaml_dict['form'] = CorrectedFormDict specification = Yaml.serialize(yaml_dict) connection.execute(update_workflows, spec=specification, id=wf.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text("update workflow set specification = :spec where id = :id") for wf in connection.execute(fetch_workflows): try: Workflow._verify_specification(wf.specification) except Exception, e: continue #dont modify invalid workflows yaml_dict = Yaml.unserialize(wf.specification) if not(yaml_dict.get('form')): yaml_dict['form'] = FormDict specification = Yaml.serialize(yaml_dict) connection.execute(update_workflows, spec=specification, id=wf.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text( "update workflow set specification = :spec where id = :id") for wf in connection.execute(fetch_workflows): try: Workflow._verify_specification(wf.specification) except Exception, e: continue #dont modify invalid workflows yaml_dict = Yaml.unserialize(wf.specification) if not (yaml_dict.get('form')): yaml_dict['form'] = FormDict specification = Yaml.serialize(yaml_dict) connection.execute(update_workflows, spec=specification, id=wf.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") delete_executions = text( "delete from execution where run_id in (select id from run where workflow_id = :id)" ) delete_products = text( "delete from product where run_id in (select id from run where workflow_id = :id)" ) delete_runs = text( "delete from run where workflow_id in (select id from workflow where id = :id)" ) delete_workflow = text("delete from workflow where id = :id") for wf in connection.execute(fetch_workflows): yaml = Yaml.unserialize(wf.specification) schema = yaml.get('schema') steps = yaml.get('steps') if wf.is_service or not (schema and steps): continue if (_has_operation(steps, 'enamel:create-infoset') and 'document_id' not in schema['structure']): connection.execute(delete_executions, id=wf.id) connection.execute(delete_products, id=wf.id) connection.execute(delete_runs, id=wf.id) connection.execute(delete_workflow, id=wf.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text("update workflow set specification = :spec where id = :id") for workflow in connection.execute(fetch_workflows): if not workflow.specification: continue specification = Yaml.unserialize(workflow.specification) if not specification or 'form' not in specification: continue form = specification.pop('form') if 'schema' in form: specification['schema'] = form['schema'] if 'layout' in form: specification['layout'] = form['layout'] specification = Yaml.serialize(specification) connection.execute(update_workflows, spec=specification, id=workflow.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") update_workflows = text("update workflow set specification = :spec where id = :id") for workflow in connection.execute(fetch_workflows): if not workflow.specification: continue specification = Yaml.unserialize(workflow.specification) if not specification or 'schema' not in specification: continue try: query = specification['schema']['structure']['infoset']['source']['query'] except: continue if query == old_query: specification['schema']['structure']['infoset']['source']['query'] = new_query specification = Yaml.serialize(specification) connection.execute(update_workflows, spec=specification, id=workflow.id)
def upgrade(): connection = op.get_bind() fetch_workflows = text("select * from workflow") delete_executions = text( "delete from execution where run_id in (select id from run where workflow_id = :id)") delete_products = text( "delete from product where run_id in (select id from run where workflow_id = :id)") delete_runs = text( "delete from run where workflow_id in (select id from workflow where id = :id)") delete_workflow = text("delete from workflow where id = :id") for wf in connection.execute(fetch_workflows): yaml = Yaml.unserialize(wf.specification) schema = yaml.get('schema') steps = yaml.get('steps') if wf.is_service or not (schema and steps): continue if (_has_operation(steps, 'enamel:create-infoset') and 'document_id' not in schema['structure']): connection.execute(delete_executions, id=wf.id) connection.execute(delete_products, id=wf.id) connection.execute(delete_runs, id=wf.id) connection.execute(delete_workflow, id=wf.id)