"""empty message

Revision ID: d6a54eeeaeb9
Revises: 
Create Date: 2020-12-21 14:00:52.018606

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('agents',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=100), nullable=False),
    sa.Column('src_ip', sa.String(length=15), nullable=False),
    sa.Column('uuid', sa.String(length=60), nullable=False),
    sa.Column('status', sa.String(length=20), nullable=False),
    sa.Column('hc_status', sa.String(length=6000), nullable=True),
    sa.Column('last_checkn', sa.DateTime(), nullable=True),
    sa.Column('benchmark', sa.String(length=20), nullable=True),
    sa.Column('cpu_count', sa.Integer(), nullable=True),
    sa.Column('gpu_count', sa.Integer(), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('customers',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=40), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('hashes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('sub_ciphertext', sa.String(length=32), nullable=False),
    sa.Column('ciphertext', sa.String(length=4096), nullable=False),
    sa.Column('hashtype', sa.Integer(), nullable=False),
    sa.Column('cracked', sa.Boolean(), nullable=False),
    sa.Column('plaintext', sa.String(length=256), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('settings',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('retention_period', sa.Integer(), nullable=True),
    sa.Column('hashcat_path', sa.String(length=255), nullable=True),
    sa.Column('db_version', sa.String(length=5), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('task_queues',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('last_updated', sa.DateTime(), nullable=False),
    sa.Column('status', sa.String(length=20), nullable=False),
    sa.Column('command', sa.String(length=256), nullable=False),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('users',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('first_name', sa.String(length=20), nullable=False),
    sa.Column('last_name', sa.String(length=20), nullable=False),
    sa.Column('email_address', sa.String(length=50), nullable=False),
    sa.Column('password', sa.String(length=60), nullable=False),
    sa.Column('admin', sa.Boolean(), nullable=False),
    sa.Column('pushover_id', sa.String(length=20), nullable=True),
    sa.Column('pushover_key', sa.String(length=20), nullable=True),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email_address')
    )
    op.create_table('hashfiles',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=256), nullable=False),
    sa.Column('hash_str', sa.String(length=256), nullable=False),
    sa.Column('uploaded_at', sa.DateTime(), nullable=False),
    sa.Column('runtime', sa.Integer(), nullable=True),
    sa.Column('customer_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['customer_id'], ['customers.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('jobs',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=50), nullable=False),
    sa.Column('created', sa.DateTime(), nullable=False),
    sa.Column('updated_at', sa.DateTime(), nullable=False),
    sa.Column('status', sa.String(length=20), nullable=False),
    sa.Column('started_at', sa.DateTime(), nullable=True),
    sa.Column('ended_at', sa.DateTime(), nullable=True),
    sa.Column('owner_id', sa.Integer(), nullable=False),
    sa.Column('notify_completed', sa.Boolean(), nullable=False),
    sa.ForeignKeyConstraint(['owner_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('rules',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=50), nullable=False),
    sa.Column('last_updated', sa.DateTime(), nullable=False),
    sa.Column('owner_id', sa.Integer(), nullable=False),
    sa.Column('path', sa.String(length=256), nullable=False),
    sa.Column('size', sa.Integer(), nullable=False),
    sa.Column('checksum', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['owner_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('task_groups',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=50), nullable=False),
    sa.Column('owner_id', sa.Integer(), nullable=False),
    sa.Column('tasks', sa.String(length=1024), nullable=False),
    sa.ForeignKeyConstraint(['owner_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('tasks',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=50), nullable=False),
    sa.Column('hc_attackmode', sa.String(length=25), nullable=False),
    sa.Column('owner_id', sa.Integer(), nullable=False),
    sa.Column('wl_id', sa.Integer(), nullable=True),
    sa.Column('rule_id', sa.Integer(), nullable=True),
    sa.Column('hc_mask', sa.String(length=50), nullable=True),
    sa.Column('keyspace', sa.BigInteger(), nullable=False),
    sa.ForeignKeyConstraint(['owner_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('wordlists',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('name', sa.String(length=256), nullable=False),
    sa.Column('last_updated', sa.DateTime(), nullable=False),
    sa.Column('owner_id', sa.Integer(), nullable=False),
    sa.Column('type', sa.String(length=7), nullable=True),
    sa.Column('path', sa.String(length=245), nullable=False),
    sa.Column('size', sa.Integer(), nullable=False),
    sa.Column('checksum', sa.String(length=64), nullable=False),
    sa.ForeignKeyConstraint(['owner_id'], ['users.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('hashfile_hashes',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('hash_id', sa.Integer(), nullable=False),
    sa.Column('username', sa.String(length=256), nullable=True),
    sa.Column('hashfile_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['hash_id'], ['hashes.id'], ),
    sa.ForeignKeyConstraint(['hashfile_id'], ['hashfiles.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('job_tasks',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('job_id', sa.Integer(), nullable=False),
    sa.Column('task_id', sa.Integer(), nullable=False),
    sa.Column('status', sa.String(length=50), nullable=False),
    sa.Column('keyspace_pos', sa.BigInteger(), nullable=False),
    sa.Column('Keyspace', sa.BigInteger(), nullable=False),
    sa.ForeignKeyConstraint(['job_id'], ['jobs.id'], ),
    sa.ForeignKeyConstraint(['task_id'], ['tasks.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('job_tasks')
    op.drop_table('hashfile_hashes')
    op.drop_table('wordlists')
    op.drop_table('tasks')
    op.drop_table('task_groups')
    op.drop_table('rules')
    op.drop_table('jobs')
    op.drop_table('hashfiles')
    op.drop_table('users')
    op.drop_table('task_queues')
    op.drop_table('settings')
    op.drop_table('hashes')
    op.drop_table('customers')
    op.drop_table('agents')
    # ### end Alembic commands ###
