content: """add_integrations_table
  
  Revision ID: 20250911184844
  Revises: 20250626135404_ce87e879766b
  Create Date: 2025-09-11 18:48:44.000000
  
  """
  
  from typing import Sequence, Union
  
  from alembic import op
  import sqlalchemy as sa
  from sqlalchemy.dialects import postgresql
  
  # revision identifiers, used by Alembic.
  revision: str = "20250911184844"
  down_revision: Union[str, None] = "20250626135404_ce87e879766b"
  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(
          "integrations",
          sa.Column("integration_id", sa.String(length=255), nullable=False),
          sa.Column("name", sa.String(length=255), nullable=False),
          sa.Column("integration_type", sa.String(length=50), nullable=False),
          sa.Column("status", sa.String(length=20), nullable=False),
          sa.Column("active", sa.Boolean(), nullable=False),
          sa.Column("auth_data", postgresql.JSONB(astext_type=sa.Text()), nullable=True),
          sa.Column("scope_data", postgresql.JSONB(astext_type=sa.Text()), nullable=True),
          sa.Column(
              "integration_metadata",
              postgresql.JSONB(astext_type=sa.Text()),
              nullable=True,
          ),
          sa.Column("unique_identifier", sa.String(length=255), nullable=False),
          sa.Column("created_by", sa.String(length=255), nullable=False),
          sa.Column(
              "created_at",
              sa.TIMESTAMP(timezone=True),
              server_default=sa.text("now()"),
              nullable=False,
          ),
          sa.Column(
              "updated_at",
              sa.TIMESTAMP(timezone=True),
              server_default=sa.text("now()"),
              nullable=False,
          ),
          sa.PrimaryKeyConstraint("integration_id"),
      )
  
      # Create indexes for better query performance
      op.create_index(
          op.f("ix_integrations_integration_type"),
          "integrations",
          ["integration_type"],
          unique=False,
      )
      op.create_index(
          op.f("ix_integrations_unique_identifier"),
          "integrations",
          ["unique_identifier"],
          unique=True,
      )
      # ### end Alembic commands ###
  
  
  def downgrade() -> None:
      # ### commands auto generated by Alembic - please adjust! ###
      op.drop_index(op.f("ix_integrations_unique_identifier"), table_name="integrations")
      op.drop_index(op.f("ix_integrations_created_by"), table_name="integrations")
      op.drop_table("integrations")
      # ### end Alembic commands ###
  