"""ip ban

Revision ID: 3f17b9ab55e4
Revises: b58c4301d1ad
Create Date: 2023-12-30 17:23:32.363913

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '3f17b9ab55e4'
down_revision = 'b58c4301d1ad'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('ip_ban',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('ip_address', sa.String(length=50), nullable=True),
    sa.Column('notes', sa.String(length=150), nullable=True),
    sa.Column('created_at', sa.DateTime(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    with op.batch_alter_table('ip_ban', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_ip_ban_ip_address'), ['ip_address'], unique=False)

    with op.batch_alter_table('user', schema=None) as batch_op:
        batch_op.add_column(sa.Column('ip_address', sa.String(length=50), nullable=True))

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('user', schema=None) as batch_op:
        batch_op.drop_column('ip_address')

    with op.batch_alter_table('ip_ban', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_ip_ban_ip_address'))

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