"""add direct vendor push fields

Revision ID: direct_vendor_push_fields
Revises: jd_cps_order_fields
Create Date: 2026-07-01 16:30:00.000000
"""
from __future__ import annotations

from alembic import op
import sqlalchemy as sa


revision = "direct_vendor_push_fields"
down_revision = "jd_cps_order_fields"
branch_labels = None
depends_on = None


def upgrade() -> None:
    with op.batch_alter_table("device_liveness") as batch_op:
        batch_op.add_column(sa.Column("push_vendor", sa.String(length=32), nullable=True))
        batch_op.add_column(sa.Column("push_token", sa.String(length=256), nullable=True))
        batch_op.create_index("ix_device_liveness_push_vendor", ["push_vendor"])


def downgrade() -> None:
    with op.batch_alter_table("device_liveness") as batch_op:
        batch_op.drop_index("ix_device_liveness_push_vendor")
        batch_op.drop_column("push_token")
        batch_op.drop_column("push_vendor")
