content: """add_message_attachments_table
  
  Revision ID: 20250626135404_ce87e879766b
  Revises: 20250626135047_a7f9c1ec89e2
  Create Date: 2025-06-26 13:54:04.522807
  
  """
  
  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 = "20250626135404_ce87e879766b"
  down_revision: Union[str, None] = "20250626135047_a7f9c1ec89e2"
  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(
          "message_attachments",
          sa.Column("id", sa.String(length=255), nullable=False),
          sa.Column("message_id", sa.String(length=255), nullable=True),
          sa.Column(
              "attachment_type",
              sa.Enum("IMAGE", "VIDEO", "AUDIO", "DOCUMENT", name="attachmenttype"),
              nullable=False,
          ),
          sa.Column("file_name", sa.String(length=255), nullable=False),
          sa.Column("file_size", sa.Integer(), nullable=False),
          sa.Column("mime_type", sa.String(length=100), nullable=False),
          sa.Column("storage_path", sa.String(length=500), nullable=False),
          sa.Column(
              "storage_provider",
              sa.Enum("LOCAL", "GCS", "S3", "AZURE", name="storageprovider"),
              nullable=False,
          ),
          sa.Column(
              "file_metadata", postgresql.JSONB(astext_type=sa.Text()), nullable=True
          ),
          sa.Column("created_at", sa.TIMESTAMP(timezone=True), nullable=False),
          sa.ForeignKeyConstraint(["message_id"], ["messages.id"], ondelete="CASCADE"),
          sa.PrimaryKeyConstraint("id"),
      )
      op.create_index(
          op.f("ix_message_attachments_message_id"),
          "message_attachments",
          ["message_id"],
          unique=False,
      )
      # ### end Alembic commands ###
  
  
  def downgrade() -> None:
      # ### commands auto generated by Alembic - please adjust! ###
      op.drop_index(
          op.f("ix_message_attachments_message_id"), table_name="message_attachments"
      )
      op.drop_table("message_attachments")
      # Drop the enums created in upgrade
      op.execute("DROP TYPE attachmenttype")
      op.execute("DROP TYPE storageprovider")
      # ### end Alembic commands ###
  