"""gazette_files

Revision ID: 1986f3e16316
Revises: 4c8a62ba844a
Create Date: 2015-03-18 09:05:57.232651

"""

# revision identifiers, used by Alembic.
revision = '1986f3e16316'
down_revision = '4c8a62ba844a'
branch_labels = None
depends_on = None

from alembic import op
import sqlalchemy as sa


def upgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.execute('ALTER TABLE gazette_file_join ADD COLUMN id SERIAL')
    op.alter_column('gazette_file_join', 'file_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.alter_column('gazette_file_join', 'gazette_id',
               existing_type=sa.INTEGER(),
               nullable=False)
    op.create_index(u'ix_gazette_file_join_file_id', 'gazette_file_join', ['file_id'], unique=False)
    op.create_index(u'ix_gazette_file_join_gazette_id', 'gazette_file_join', ['gazette_id'], unique=False)
    ### end Alembic commands ###


def downgrade():
    ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(u'ix_gazette_file_join_gazette_id', table_name='gazette_file_join')
    op.drop_index(u'ix_gazette_file_join_file_id', table_name='gazette_file_join')
    op.alter_column('gazette_file_join', 'gazette_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.alter_column('gazette_file_join', 'file_id',
               existing_type=sa.INTEGER(),
               nullable=True)
    op.drop_column('gazette_file_join', 'id')
    ### end Alembic commands ###
