"""meituan_coupon image size & type

给 meituan_coupon 增加 image_size(字节)/ image_type(MIME)两列,采集时 HEAD 头图得到,
供读取侧按图片大小决定是否拼缩放参数提速。两列均 nullable,不动存量行;下一轮全量 ETL
upsert 自动回填,无需手动 backfill。

Revision ID: meituan_coupon_image_meta
Revises: feedback_review_fields
Create Date: 2026-06-23 00:00:00.000000

"""

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "meituan_coupon_image_meta"
down_revision: str | Sequence[str] | None = "feedback_review_fields"
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade() -> None:
    with op.batch_alter_table("meituan_coupon", schema=None) as batch_op:
        batch_op.add_column(sa.Column("image_size", sa.Integer(), nullable=True))
        batch_op.add_column(sa.Column("image_type", sa.String(length=32), nullable=True))


def downgrade() -> None:
    with op.batch_alter_table("meituan_coupon", schema=None) as batch_op:
        batch_op.drop_column("image_type")
        batch_op.drop_column("image_size")
