"""Password reset

Revision ID: ec8724ff64dc
Revises: 8915acdd2939
Create Date: 2020-10-30 07:44:47.978110

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = 'ec8724ff64dc'
down_revision = '8915acdd2939'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('reset_passwords',
    sa.Column('id', postgresql.UUID(as_uuid=True), nullable=False),
    sa.Column('user_id', postgresql.UUID(as_uuid=True), nullable=True),
    sa.Column('completed', sa.Boolean(), nullable=False),
    sa.Column('created_at', sa.DateTime(timezone=True), server_default=sa.text("TIMEZONE('utc', statement_timestamp())"), nullable=False),
    sa.ForeignKeyConstraint(['user_id'], ['users.id'], name='fk_reset_passwords_user_id'),
    sa.PrimaryKeyConstraint('id', name=op.f('pk_reset_passwords')),
    sa.UniqueConstraint('id', name=op.f('uq_reset_passwords_id'))
    )
    op.create_index(op.f('ix_reset_passwords_user_id'), 'reset_passwords', ['user_id'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_reset_passwords_user_id'), table_name='reset_passwords')
    op.drop_table('reset_passwords')
    # ### end Alembic commands ###
