def upgrade(migrate_engine): print(__doc__) metadata.bind = migrate_engine metadata.reflect() if migrate_engine.name in ['postgres', 'postgresql']: subworkflow_id_column = Column("subworkflow_id", Integer, ForeignKey("workflow.id"), nullable=True) input_subworkflow_step_id_column = Column("input_subworkflow_step_id", Integer, ForeignKey("workflow_step.id"), nullable=True) parent_workflow_id_column = Column("parent_workflow_id", Integer, ForeignKey("workflow.id"), nullable=True) else: subworkflow_id_column = Column("subworkflow_id", Integer, nullable=True) input_subworkflow_step_id_column = Column("input_subworkflow_step_id", Integer, nullable=True) parent_workflow_id_column = Column("parent_workflow_id", Integer, nullable=True) add_column(subworkflow_id_column, "workflow_step", metadata) add_column(input_subworkflow_step_id_column, "workflow_step_connection", metadata) add_column(parent_workflow_id_column, "workflow", metadata) workflow_output_label_column = Column("label", TrimmedString(255)) workflow_output_uuid_column = Column("uuid", UUIDType, nullable=True) add_column(workflow_output_label_column, "workflow_output", metadata) add_column(workflow_output_uuid_column, "workflow_output", metadata) # Make stored_workflow_id nullable, since now workflows can belong to either # a stored workflow or a parent workflow. alter_column("stored_workflow_id", "workflow", metadata, nullable=True) for table in TABLES: # Indexes are automatically created when the tables are. create_table(table)
def upgrade(migrate_engine): print(__doc__) metadata.bind = migrate_engine metadata.reflect() # Make workflow_step_id nullable to allow for PJAs to be created for # individual jobs. alter_column("workflow_step_id", "post_job_action", metadata, nullable=True)
def downgrade(migrate_engine): metadata.bind = migrate_engine metadata.reflect() jobs_table = Table("job", metadata, autoload=True) tasks_table = Table("task", metadata, autoload=True) for colname in ["job_messages", "job_stdout", "job_stderr"]: drop_column(colname, jobs_table) drop_column(colname, tasks_table) for table in [jobs_table, tasks_table]: alter_column('tool_stdout', table, name='stdout') alter_column('tool_stderr', table, name='stderr')
def upgrade(migrate_engine): print(__doc__) metadata.bind = migrate_engine metadata.reflect() jobs_table = Table("job", metadata, autoload=True) job_messages_column = Column("job_messages", JSONType, nullable=True) add_column(job_messages_column, jobs_table, metadata) job_job_stdout_column = Column("job_stdout", TEXT, nullable=True) add_column(job_job_stdout_column, jobs_table, metadata) job_job_stderr_column = Column("job_stderr", TEXT, nullable=True) add_column(job_job_stderr_column, jobs_table, metadata) tasks_table = Table("task", metadata, autoload=True) task_job_messages_column = Column("job_messages", JSONType, nullable=True) add_column(task_job_messages_column, tasks_table, metadata) task_job_stdout_column = Column("job_stdout", TEXT, nullable=True) add_column(task_job_stdout_column, tasks_table, metadata) task_job_stderr_column = Column("job_stderr", TEXT, nullable=True) add_column(task_job_stderr_column, tasks_table, metadata) for table in [jobs_table, tasks_table]: alter_column('stdout', table, name='tool_stdout') alter_column('stderr', table, name='tool_stderr')