"""add safe house remind func

迁移 ID: f9c6a7111d67
父迁移: 0ef2cf7a5041
创建时间: 2025-07-23 20:01:43.275482

"""
from __future__ import annotations

from collections.abc import Sequence

from alembic import op
import sqlalchemy as sa
from sqlalchemy import text


revision: str = 'f9c6a7111d67'
down_revision: str | Sequence[str] | None = '0ef2cf7a5041'
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! ###
    op.create_table('nonebot_plugin_delta_helper_safehouserecord',
    sa.Column('qq_id', sa.Integer(), nullable=False),
    sa.Column('device_id', sa.String(), nullable=False),
    sa.Column('object_id', sa.Integer(), nullable=False),
    sa.Column('object_name', sa.String(), nullable=False),
    sa.Column('place_name', sa.String(), nullable=False),
    sa.Column('left_time', sa.Integer(), nullable=False),
    sa.Column('push_time', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('qq_id', 'device_id', name=op.f('pk_nonebot_plugin_delta_helper_safehouserecord')),
    info={'bind_key': 'nonebot_plugin_delta_helper'}
    )
    with op.batch_alter_table('nonebot_plugin_delta_helper_userdata', schema=None) as batch_op:
        batch_op.add_column(sa.Column('if_remind_safehouse', sa.Boolean(), nullable=False, default=False, server_default=text('false')))

    # ### end Alembic commands ###


def downgrade(name: str = "") -> None:
    if name:
        return
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('nonebot_plugin_delta_helper_userdata', schema=None) as batch_op:
        batch_op.drop_column('if_remind_safehouse')

    op.drop_table('nonebot_plugin_delta_helper_safehouserecord')
    # ### end Alembic commands ###
