"""empty message

Revision ID: 8ae5aae58f62
Revises: 26a8e4006aea
Create Date: 2016-10-31 03:40:05.718978

"""

# revision identifiers, used by Alembic.
revision = '8ae5aae58f62'
down_revision = '26a8e4006aea'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa

from sqlalchemy_utils.types import TSVectorType
from sqlalchemy_searchable import make_searchable
import sqlalchemy_utils

# Patch in knowledge of the citext type, so it reflects properly.
from sqlalchemy.dialects.postgresql.base import ischema_names
import citext
import queue
import datetime
from sqlalchemy.dialects.postgresql import ENUM
from sqlalchemy.dialects.postgresql import JSON
from sqlalchemy.dialects.postgresql import TSVECTOR
ischema_names['citext'] = citext.CIText



def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.create_table('nu_release_item',
    sa.Column('id', sa.BigInteger(), nullable=False),
    sa.Column('validated', sa.Boolean(), nullable=False),
    sa.Column('actual_target', sa.Text(), nullable=True),
    sa.Column('seriesname', sa.Text(), nullable=False),
    sa.Column('releaseinfo', sa.Text(), nullable=True),
    sa.Column('groupinfo', sa.Text(), nullable=False),
    sa.Column('referrer', sa.Text(), nullable=False),
    sa.Column('outbound_wrapper', sa.Text(), nullable=False),
    sa.Column('first_seen', sa.DateTime(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('seriesname', 'releaseinfo', 'groupinfo', 'outbound_wrapper', 'actual_target')
    )
    op.create_index(op.f('ix_nu_release_item_groupinfo'), 'nu_release_item', ['groupinfo'], unique=False)
    op.create_index(op.f('ix_nu_release_item_seriesname'), 'nu_release_item', ['seriesname'], unique=False)
    op.create_table('nu_resolved_outbound',
    sa.Column('id', sa.BigInteger(), nullable=False),
    sa.Column('parent', sa.BigInteger(), nullable=False),
    sa.Column('client_id', sa.Text(), nullable=False),
    sa.Column('client_key', sa.Text(), nullable=False),
    sa.Column('actual_target', sa.Text(), nullable=False),
    sa.Column('fetched_on', sa.DateTime(), nullable=False),
    sa.ForeignKeyConstraint(['parent'], ['nu_release_item.id'], ),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('client_id', 'client_key', 'actual_target')
    )
    op.create_index(op.f('ix_nu_resolved_outbound_client_id'), 'nu_resolved_outbound', ['client_id'], unique=False)
    op.create_index(op.f('ix_nu_resolved_outbound_client_key'), 'nu_resolved_outbound', ['client_key'], unique=False)
    op.create_index(op.f('ix_nu_resolved_outbound_parent'), 'nu_resolved_outbound', ['parent'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_nu_resolved_outbound_parent'), table_name='nu_resolved_outbound')
    op.drop_index(op.f('ix_nu_resolved_outbound_client_key'), table_name='nu_resolved_outbound')
    op.drop_index(op.f('ix_nu_resolved_outbound_client_id'), table_name='nu_resolved_outbound')
    op.drop_table('nu_resolved_outbound')
    op.drop_index(op.f('ix_nu_release_item_seriesname'), table_name='nu_release_item')
    op.drop_index(op.f('ix_nu_release_item_groupinfo'), table_name='nu_release_item')
    op.drop_table('nu_release_item')
    ### end Alembic commands ###
