"""empty message

Revision ID: 7fed941b21a2
Revises:
Create Date: 2021-07-23 20:32:15.721760

"""
from alembic import op
import sqlalchemy as sa

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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    hitmen_table = op.create_table('hitmen',
                                   sa.Column('id', sa.Integer(), nullable=False),
                                   sa.Column('name', sa.String(length=100), nullable=False),
                                   sa.Column('email', sa.String(length=100), nullable=False),
                                   sa.Column('is_active', sa.Boolean(), server_default='True', nullable=False),
                                   sa.Column('level', sa.Text(), nullable=True),
                                   sa.Column('created_at', sa.DateTime(), server_default='2021-07-24 01:32:15.639063',
                                             nullable=False),
                                   sa.PrimaryKeyConstraint('id')
                                   )
    op.create_index(op.f('ix_hitmen_email'), 'hitmen', ['email'], unique=True)
    op.create_table('hits',
                    sa.Column('id', sa.Integer(), nullable=False),
                    sa.Column('description', sa.String(length=100), nullable=False),
                    sa.Column('target', sa.String(length=100), nullable=False),
                    sa.Column('hitman_id', sa.Integer(), nullable=True),
                    sa.Column('assigned_by_id', sa.Integer(), nullable=True),
                    sa.Column('status', sa.String(length=50), server_default='active', nullable=True),
                    sa.Column('is_active', sa.Boolean(), server_default='False', nullable=False),
                    sa.Column('created_at', sa.DateTime(), server_default='2021-07-24 01:32:15.642051', nullable=False),
                    sa.ForeignKeyConstraint(['assigned_by_id'], ['hitmen.id'], ),
                    sa.ForeignKeyConstraint(['hitman_id'], ['hitmen.id'], ),
                    sa.PrimaryKeyConstraint('id')
                    )
    op.create_table('managers_lackeys',
                    sa.Column('manager_id', sa.Integer(), nullable=False),
                    sa.Column('lackey_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(['lackey_id'], ['hitmen.id'], ),
                    sa.ForeignKeyConstraint(['manager_id'], ['hitmen.id'], ),
                    sa.PrimaryKeyConstraint('manager_id', 'lackey_id')
                    )
    # ### end Alembic commands ###

    op.bulk_insert(
        hitmen_table,
        [
            {
                'name': 'the_boss',
                'email': 'the_boss@spy.io',
                'level': 'BOSS'
            },
            {
                'name': 'manager_one',
                'email': 'manager_1@spy.io',
                'level': 'MANAGER'
            },
            {
                'name': 'manager_two',
                'email': 'manager_2@spy.io',
                'level': 'MANAGER'
            },
            {
                'name': 'manager_three',
                'email': 'manager_3@spy.io',
                'level': 'MANAGER'
            },
            {
                'name': 'hitman_zero',
                'email': 'hitman_0@spy.io',
                'level': 'HITMAN'
            },
            {
                'name': 'hitman_one',
                'email': 'hitman_1@spy.io',
                'level': 'HITMAN'
            },
            {
                'name': 'hitman_two',
                'email': 'hitman_2@spy.io',
                'level': 'HITMAN'
            },
            {
                'name': 'hitman_three',
                'email': 'hitman_3@spy.io',
                'level': 'HIMAN'
            },
            {
                'name': 'hitman_four',
                'email': 'hitman_4@spy.io',
                'level': 'HITMAN'
            },
            {
                'name': 'hitman_five',
                'email': 'hitman_5@spy.io',
                'level': 'HITMAN'
            },
            {
                'name': 'hitman_six',
                'email': 'hitman_6@spy.io',
                'level': 'HITMAN'
            },
            {
                'name': 'hitman_seven',
                'email': 'hitman_7@spy.io',
                'level': 'HITMAN'
            },
            {
                'name': 'hitman_eight',
                'email': 'hitman_8@spy.io',
                'level': 'HITMAN'
            }
        ]
    )


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