"""empty message

Revision ID: 5ccaf00eb471
Revises: 
Create Date: 2021-05-28 14:35:37.332668

"""
from alembic import op
import sqlalchemy as sa


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


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('admins',
                    sa.Column('_id', sa.Integer(), nullable=False),
                    sa.Column('_uuid', sa.String(length=11), nullable=True),
                    sa.Column('username', sa.String(length=80), nullable=False),
                    sa.Column('email', sa.String(length=120), nullable=False),
                    sa.Column('password', sa.String(length=120), nullable=False),
                    sa.Column('contacts', sa.String(length=120), nullable=False),
                    sa.Column('role', sa.String(length=10), nullable=False),
                    sa.Column('active', sa.Boolean(), nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=False),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('_id'),
                    sa.UniqueConstraint('_uuid'),
                    sa.UniqueConstraint('email')
                    )
    op.create_table('organizers',
                    sa.Column('_id', sa.Integer(), nullable=False),
                    sa.Column('_uuid', sa.String(length=11), nullable=True),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('contacts', sa.String(length=80), nullable=False),
                    sa.Column('email', sa.String(length=120), nullable=False),
                    sa.Column('password', sa.String(length=120), nullable=False),
                    sa.Column('photo', sa.String(length=120), nullable=True),
                    sa.Column('active', sa.Boolean(), nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('_id'),
                    sa.UniqueConstraint('_uuid'),
                    sa.UniqueConstraint('email'),
                    sa.UniqueConstraint('name')
                    )
    op.create_table('token_block_list',
                    sa.Column('_id', sa.Integer(), nullable=False),
                    sa.Column('jti', sa.String(length=36), nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=True),
                    sa.PrimaryKeyConstraint('_id'),
                    sa.UniqueConstraint('jti')
                    )
    op.create_table('users',
                    sa.Column('_id', sa.Integer(), nullable=False),
                    sa.Column('_uuid', sa.String(length=11), nullable=True),
                    sa.Column('firstname', sa.String(length=80), nullable=False),
                    sa.Column('lastname', sa.String(length=80), nullable=False),
                    sa.Column('email', sa.String(length=120), nullable=False),
                    sa.Column('password', sa.String(length=120), nullable=False),
                    sa.Column('contacts', sa.String(length=120), nullable=False),
                    sa.Column('photo', sa.String(length=120), nullable=True),
                    sa.Column('active', sa.Boolean(), nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=False),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('deleted', sa.Boolean(), nullable=False),
                    sa.PrimaryKeyConstraint('_id'),
                    sa.UniqueConstraint('_uuid'),
                    sa.UniqueConstraint('email')
                    )
    op.create_table('events',
                    sa.Column('_id', sa.Integer(), nullable=False),
                    sa.Column('name', sa.String(length=80), nullable=False),
                    sa.Column('location', sa.String(length=80), nullable=False),
                    sa.Column('description', sa.String(length=250), nullable=True),
                    sa.Column('price', sa.Float(), nullable=True),
                    sa.Column('available_places', sa.Integer(), nullable=False),
                    sa.Column('remaining_places', sa.Integer(), nullable=False),
                    sa.Column('start_at', sa.String(length=80), nullable=False),
                    sa.Column('end_at', sa.String(length=80), nullable=False),
                    sa.Column('image', sa.String(length=120), nullable=True),
                    sa.Column('active', sa.Boolean(), nullable=False),
                    sa.Column('allow', sa.Boolean(), nullable=False),
                    sa.Column('organizer_id', sa.Integer(), nullable=False),
                    sa.Column('created_at', sa.DateTime(), nullable=False),
                    sa.Column('updated_at', sa.DateTime(), nullable=True),
                    sa.Column('deleted', sa.Boolean(), nullable=False),
                    sa.ForeignKeyConstraint(['organizer_id'], ['organizers._id'], ),
                    sa.PrimaryKeyConstraint('_id')
                    )
    op.create_table('favourite_events',
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('event_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(['event_id'], ['events._id'], ),
                    sa.ForeignKeyConstraint(['user_id'], ['users._id'], ),
                    sa.PrimaryKeyConstraint('user_id', 'event_id')
                    )
    op.create_table('participant_events',
                    sa.Column('user_id', sa.Integer(), nullable=False),
                    sa.Column('event_id', sa.Integer(), nullable=False),
                    sa.ForeignKeyConstraint(['event_id'], ['events._id'], ),
                    sa.ForeignKeyConstraint(['user_id'], ['users._id'], ),
                    sa.PrimaryKeyConstraint('user_id', 'event_id')
                    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('participant_events')
    op.drop_table('favourite_events')
    op.drop_table('events')
    op.drop_table('users')
    op.drop_table('token_block_list')
    op.drop_table('organizers')
    op.drop_table('admins')
    # ### end Alembic commands ###
