"""Modification du Guest

Revision ID: d1b465f88d3b
Revises: c40b1f0ed821
Create Date: 2020-07-17 22:56:36.260431

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'd1b465f88d3b'
down_revision = 'c40b1f0ed821'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('guest', sa.Column('name', sa.Unicode(length=64), nullable=True))
    op.drop_index('ix_guest_username', table_name='guest')
    op.drop_column('guest', 'ip')
    op.drop_column('guest', 'username')
    op.alter_column('member', 'avatar_id',
               existing_type=sa.INTEGER(),
               nullable=True,
               existing_server_default=sa.text('0'))
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('member', 'avatar_id',
               existing_type=sa.INTEGER(),
               nullable=False,
               existing_server_default=sa.text('0'))
    op.add_column('guest', sa.Column('username', sa.VARCHAR(length=64), autoincrement=False, nullable=True))
    op.add_column('guest', sa.Column('ip', sa.VARCHAR(length=47), autoincrement=False, nullable=True))
    op.create_index('ix_guest_username', 'guest', ['username'], unique=False)
    op.drop_column('guest', 'name')
    # ### end Alembic commands ###
