from alembic import op
import sqlalchemy as sa
import sqlalchemy_utils

"""empty message

Revision ID: a031e26dc1bd
Revises: 8efa45d83a3b
Create Date: 2018-08-06 16:03:36.820890

"""

# revision identifiers, used by Alembic.
revision = 'a031e26dc1bd'
down_revision = '8efa45d83a3b'


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column('auth_providers',
                  sa.Column('created_at',
                            sa.DateTime(),
                            nullable=True))

    op.add_column('auth_providers',
                  sa.Column('token',
                            sqlalchemy_utils.types.json.JSONType(),
                            nullable=True))

    op.create_unique_constraint('auth_providers_by_provider',
                                'auth_providers',
                                ['provider', 'provider_id'])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint('auth_providers_by_provider',
                       'auth_providers',
                       type_='unique')

    op.drop_column('auth_providers', 'token')
    op.drop_column('auth_providers', 'created_at')
    # ### end Alembic commands ###
