"""Adds Audit model

Revision ID: aa82757b1084
Revises: 004ac48ffe18
Create Date: 2021-04-13 11:56:06.466072

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = 'aa82757b1084'
down_revision = '004ac48ffe18'
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic ###
    op.create_table('api_access_audits',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('create_user', sa.String(), nullable=True),
                    sa.Column('path', sa.String(), nullable=False),
                    sa.Column('create_timestamp', sa.TIMESTAMP(timezone=True), nullable=False),
                    sa.Column('success', sa.Boolean(), nullable=False),
                    sa.PrimaryKeyConstraint('id'),
                    comment='The audit log of an authenticated request by a user.'
                    )
    op.create_index(op.f('ix_api_access_audits_create_timestamp'),
                    'api_access_audits', ['create_timestamp'], unique=False)
    op.create_index(op.f('ix_api_access_audits_create_user'),
                    'api_access_audits', ['create_user'], unique=False)
    op.create_index(op.f('ix_api_access_audits_path'), 'api_access_audits', ['path'], unique=False)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic ###
    op.drop_index(op.f('ix_api_access_audits_path'), table_name='api_access_audits')
    op.drop_index(op.f('ix_api_access_audits_create_user'), table_name='api_access_audits')
    op.drop_index(op.f('ix_api_access_audits_create_timestamp'), table_name='api_access_audits')
    op.drop_table('api_access_audits')
    # ### end Alembic commands ###
