"""empty message

Revision ID: 8fa16c51ac53
Revises: 
Create Date: 2017-08-07 14:17:23.734961

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '8fa16c51ac53'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('identity',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('issuer_id', sa.Integer(), nullable=True),
    sa.Column('name', sa.String(length=255), nullable=False),
    sa.ForeignKeyConstraint(['issuer_id'], ['identity.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('issuer_id', 'name', name='_issuer_name_uc'),
    sa.UniqueConstraint('name')
    )
    op.create_table('pair',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('identity_id', sa.Integer(), nullable=False),
    sa.Column('issued_at', sa.DateTime(), nullable=True),
    sa.Column('cert', sa.Binary(), nullable=False),
    sa.Column('key', sa.Binary(), nullable=False),
    sa.ForeignKeyConstraint(['identity_id'], ['identity.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('identity_id', 'issued_at', name='_identity_issued_at_uc')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('pair')
    op.drop_table('identity')
    # ### end Alembic commands ###
