"""tabela tribunais

Revision ID: d4280d5f1202
Revises: 
Create Date: 2020-08-13 12:30:19.510767

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('tribunal',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('nome', sa.String(length=50), nullable=True),
    sa.Column('sigla', sa.String(length=10), nullable=True),
    sa.Column('codigo', sa.String(length=10), nullable=True),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_tribunal_codigo'), 'tribunal', ['codigo'], unique=True)
    op.create_index(op.f('ix_tribunal_sigla'), 'tribunal', ['sigla'], unique=True)
    op.create_table('processo',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('numero', sa.String(length=30), nullable=True),
    sa.Column('juiz', sa.String(length=50), nullable=True),
    sa.Column('tribunal_id', sa.Integer(), nullable=True),
    sa.ForeignKeyConstraint(['tribunal_id'], ['tribunal.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_index(op.f('ix_processo_numero'), 'processo', ['numero'], unique=True)
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f('ix_processo_numero'), table_name='processo')
    op.drop_table('processo')
    op.drop_index(op.f('ix_tribunal_sigla'), table_name='tribunal')
    op.drop_index(op.f('ix_tribunal_codigo'), table_name='tribunal')
    op.drop_table('tribunal')
    # ### end Alembic commands ###
