"""2022-07-18-Initial migration

Revision ID: b41381c40567
Revises: 
Create Date: 2022-07-18 13:46:02.845233

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('pwndoc_mapping',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('fid', sa.String(length=80), nullable=False),
    sa.Column('pwndoc_id', sa.String(length=80), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    with op.batch_alter_table('pwndoc_mapping', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_pwndoc_mapping_fid'), ['fid'], unique=True)
        batch_op.create_index(batch_op.f('ix_pwndoc_mapping_pwndoc_id'), ['pwndoc_id'], unique=True)

    op.create_table('templates',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('fid', sa.String(length=80), nullable=False),
    sa.Column('locale', sa.String(length=10), nullable=False),
    sa.Column('content', sa.Text(), nullable=False),
    sa.Column('timestamp', sa.Integer(), nullable=True),
    sa.Column('deleted', sa.Boolean(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    with op.batch_alter_table('templates', schema=None) as batch_op:
        batch_op.create_index(batch_op.f('ix_templates_fid'), ['fid'], unique=False)

    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    with op.batch_alter_table('templates', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_templates_fid'))

    op.drop_table('templates')
    with op.batch_alter_table('pwndoc_mapping', schema=None) as batch_op:
        batch_op.drop_index(batch_op.f('ix_pwndoc_mapping_pwndoc_id'))
        batch_op.drop_index(batch_op.f('ix_pwndoc_mapping_fid'))

    op.drop_table('pwndoc_mapping')
    # ### end Alembic commands ###
