"""workflow_templates table updates oss

Revision ID: b4738bd17198
Revises: 7ab8e817802a
Create Date: 2025-12-12 02:32:15.078365+00:00

"""

from typing import Sequence, Union

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "b4738bd17198"
down_revision: Union[str, None] = "7ab8e817802a"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "workflow_templates",
        sa.Column("workflow_template_id", sa.String(), nullable=False),
        sa.Column("workflow_permanent_id", sa.String(), nullable=False),
        sa.Column("organization_id", sa.String(), nullable=False),
        sa.Column("created_at", sa.DateTime(), nullable=False),
        sa.Column("modified_at", sa.DateTime(), nullable=False),
        sa.Column("deleted_at", sa.DateTime(), nullable=True),
        sa.ForeignKeyConstraint(
            ["organization_id"],
            ["organizations.organization_id"],
        ),
        sa.PrimaryKeyConstraint("workflow_template_id"),
    )
    op.create_index(
        op.f("ix_workflow_templates_organization_id"), "workflow_templates", ["organization_id"], unique=False
    )
    op.create_index(
        op.f("ix_workflow_templates_workflow_permanent_id"),
        "workflow_templates",
        ["workflow_permanent_id"],
        unique=False,
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_workflow_templates_workflow_permanent_id"), table_name="workflow_templates")
    op.drop_index(op.f("ix_workflow_templates_organization_id"), table_name="workflow_templates")
    op.drop_table("workflow_templates")
    # ### end Alembic commands ###
