"""add workflow tables only Revision ID: 010_add_workflow_tables_only Revises: f7af0923d38b Create Date: 2025-08-18 09:03:00.000000 """ from alembic import op import sqlalchemy as sa from sqlalchemy.dialects import postgresql # revision identifiers, used by Alembic. revision = '010_add_workflow_tables_only' down_revision = 'f7af0923d38b' branch_labels = None depends_on = None def upgrade() -> None: # Create workflow_definitions table op.create_table('workflow_definitions', sa.Column('id', sa.String(), nullable=False), sa.Column('name', sa.String(length=255), nullable=False), sa.Column('description', sa.Text(), nullable=True), sa.Column('version', sa.String(length=50), nullable=True), sa.Column('steps', sa.JSON(), nullable=False), sa.Column('variables', sa.JSON(), nullable=True), sa.Column('metadata', sa.JSON(), nullable=True), sa.Column('timeout', sa.Integer(), nullable=True), sa.Column('is_active', sa.Boolean(), nullable=True), sa.Column('created_by', sa.String(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.PrimaryKeyConstraint('id') ) # Create workflow_executions table op.create_table('workflow_executions', sa.Column('id', sa.String(), nullable=False), sa.Column('workflow_id', sa.String(), nullable=False), sa.Column('status', sa.Enum('PENDING', 'RUNNING', 'COMPLETED', 'FAILED', 'CANCELLED', name='workflowstatus'), nullable=True), sa.Column('current_step', sa.String(), nullable=True), sa.Column('input_data', sa.JSON(), nullable=True), sa.Column('context', sa.JSON(), nullable=True), sa.Column('results', sa.JSON(), nullable=True), sa.Column('error', sa.Text(), nullable=True), sa.Column('started_at', sa.DateTime(), nullable=True), sa.Column('completed_at', sa.DateTime(), nullable=True), sa.Column('executed_by', sa.String(), nullable=False), sa.Column('created_at', sa.DateTime(), nullable=True), sa.Column('updated_at', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['workflow_id'], ['workflow_definitions.id'], ), sa.PrimaryKeyConstraint('id') ) # Create workflow_step_logs table op.create_table('workflow_step_logs', sa.Column('id', sa.String(), nullable=False), sa.Column('execution_id', sa.String(), nullable=False), sa.Column('step_id', sa.String(), nullable=False), sa.Column('step_name', sa.String(length=255), nullable=False), sa.Column('step_type', sa.String(length=50), nullable=False), sa.Column('status', sa.String(length=50), nullable=False), sa.Column('input_data', sa.JSON(), nullable=True), sa.Column('output_data', sa.JSON(), nullable=True), sa.Column('error', sa.Text(), nullable=True), sa.Column('started_at', sa.DateTime(), nullable=True), sa.Column('completed_at', sa.DateTime(), nullable=True), sa.Column('duration_ms', sa.Integer(), nullable=True), sa.Column('retry_count', sa.Integer(), nullable=True), sa.Column('created_at', sa.DateTime(), nullable=True), sa.ForeignKeyConstraint(['execution_id'], ['workflow_executions.id'], ), sa.PrimaryKeyConstraint('id') ) def downgrade() -> None: op.drop_table('workflow_step_logs') op.drop_table('workflow_executions') op.drop_table('workflow_definitions') op.execute('DROP TYPE IF EXISTS workflowstatus')