"""Migration commit

Revision ID: e715b0271e3a
Revises: 
Create Date: 2021-07-13 19:58:22.176398

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('elections',
    sa.Column('elId', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('timeStart', sa.DateTime(), nullable=False),
    sa.Column('timeEnd', sa.DateTime(), nullable=False),
    sa.Column('type', sa.SmallInteger(), nullable=False),
    sa.PrimaryKeyConstraint('elId')
    )
    op.create_table('participants',
    sa.Column('parId', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('name', sa.String(length=256), nullable=False),
    sa.Column('individual', sa.SmallInteger(), nullable=False),
    sa.PrimaryKeyConstraint('parId')
    )
    op.create_table('invalidvotes',
    sa.Column('guid', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('jmbgUser', sa.String(length=13), nullable=False),
    sa.Column('reason', sa.String(length=256), nullable=True),
    sa.Column('pollNumber', sa.Integer(), nullable=False),
    sa.Column('elId', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['elId'], ['elections.elId'], ),
    sa.PrimaryKeyConstraint('guid')
    )
    op.create_table('participations',
    sa.Column('prtId', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('pollNumber', sa.Integer(), nullable=False),
    sa.Column('parId', sa.Integer(), nullable=False),
    sa.Column('elId', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['elId'], ['elections.elId'], ),
    sa.ForeignKeyConstraint(['parId'], ['participants.parId'], ),
    sa.PrimaryKeyConstraint('prtId')
    )
    op.create_table('votes',
    sa.Column('guid', sa.Integer(), autoincrement=True, nullable=False),
    sa.Column('jmbgUser', sa.String(length=13), nullable=False),
    sa.Column('toId', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['toId'], ['participations.prtId'], ),
    sa.PrimaryKeyConstraint('guid')
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('votes')
    op.drop_table('participations')
    op.drop_table('invalidvotes')
    op.drop_table('participants')
    op.drop_table('elections')
    # ### end Alembic commands ###
