"""empty message

Revision ID: 6df08933f991
Revises: 
Create Date: 2021-04-23 13:10:24.786163

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('usuarios',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('nome', sa.String(), nullable=False),
    sa.Column('email', sa.String(), nullable=False),
    sa.Column('password_hash', sa.String(), nullable=False),
    sa.Column('usuario_pontos', sa.Integer(), nullable=False),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('email'),
    sa.UniqueConstraint('nome')
    )
    op.create_table('perguntas',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('pergunta', sa.String(), nullable=False),
    sa.Column('resposta', sa.String(), nullable=False),
    sa.Column('usuario_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['usuario_id'], ['usuarios.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('pergunta')
    )
    op.create_table('temas',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('tema', sa.String(), nullable=False),
    sa.Column('usuario_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['usuario_id'], ['usuarios.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id'),
    sa.UniqueConstraint('tema')
    )
    op.create_table('alternativas',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('alternativa1', sa.String(), nullable=False),
    sa.Column('alternativa2', sa.String(), nullable=False),
    sa.Column('alternativa3', sa.String(), nullable=False),
    sa.Column('pergunta_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['pergunta_id'], ['perguntas.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('pergunta_temas',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('pergunta_id', sa.Integer(), nullable=False),
    sa.Column('tema_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['pergunta_id'], ['perguntas.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.ForeignKeyConstraint(['tema_id'], ['temas.id'], onupdate='CASCADE', ondelete='CASCADE'),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('pergunta_temas')
    op.drop_table('alternativas')
    op.drop_table('temas')
    op.drop_table('perguntas')
    op.drop_table('usuarios')
    # ### end Alembic commands ###
