"""add machine table

Revision ID: ad6931f0a372
Revises: d4867f3a4c0a
Create Date: 2020-05-31 09:43:13.704918

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'ad6931f0a372'
down_revision = 'd4867f3a4c0a'
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
    op.create_table('machine',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(), nullable=True),
    sa.Column('host', sa.String(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_machine_host'), 'machine', ['host'], unique=False)
    op.create_index(op.f('ix_machine_id'), 'machine', ['id'], unique=False)
    op.create_index(op.f('ix_machine_name'), 'machine', ['name'], unique=False)
    op.alter_column('user', 'email',
               existing_type=sa.VARCHAR(),
               nullable=False)
    op.alter_column('user', 'hashed_password',
               existing_type=sa.VARCHAR(),
               nullable=False)
    # ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('user', 'hashed_password',
               existing_type=sa.VARCHAR(),
               nullable=True)
    op.alter_column('user', 'email',
               existing_type=sa.VARCHAR(),
               nullable=True)
    op.drop_index(op.f('ix_machine_name'), table_name='machine')
    op.drop_index(op.f('ix_machine_id'), table_name='machine')
    op.drop_index(op.f('ix_machine_host'), table_name='machine')
    op.drop_table('machine')
    # ### end Alembic commands ###
