"""adapt user plugin

迁移 ID: 263d60026863
父迁移:
创建时间: 2024-08-01 22:42:18.427022

"""

from __future__ import annotations

from collections.abc import Sequence

import sqlalchemy as sa
from alembic import op

revision: str = "263d60026863"
down_revision: str | Sequence[str] | None = None
branch_labels: str | Sequence[str] | None = None
depends_on: str | Sequence[str] | None = None


def upgrade(name: str = "") -> None:
    if name:
        return
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("wakatime", schema=None) as batch_op:
        batch_op.add_column(sa.Column("id", sa.Integer(), nullable=False))
        batch_op.drop_column("platform")
        batch_op.drop_column("user_id")

    # ### end Alembic commands ###


def downgrade(name: str = "") -> None:
    if name:
        return
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table("wakatime", schema=None) as batch_op:
        batch_op.add_column(sa.Column("user_id", sa.VARCHAR(), nullable=False))
        batch_op.add_column(sa.Column("platform", sa.VARCHAR(), nullable=False))
        batch_op.drop_column("id")

    # ### end Alembic commands ###
