"""Add user table

Revision ID: 4f016505c7c3
Revises: 615f2c3df9bd
Create Date: 2020-07-02 14:03:35.515584

"""
import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision = "4f016505c7c3"
down_revision = "615f2c3df9bd"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "user",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("username", sa.String(length=50), nullable=False),
        sa.Column("password", sa.String(length=60), nullable=False),
        sa.PrimaryKeyConstraint("id"),
        sa.UniqueConstraint("username"),
    )
    with op.batch_alter_table("chore", schema=None) as batch_op:
        batch_op.alter_column("description", existing_type=sa.VARCHAR(), nullable=True)
        batch_op.alter_column("period", existing_type=sa.INTEGER(), nullable=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column("chore", "period", existing_type=sa.INTEGER(), nullable=False)
    op.alter_column("chore", "description", existing_type=sa.VARCHAR(), nullable=False)
    op.drop_table("user")
    # ### end Alembic commands ###
