"""add board management module tables

Revision ID: 28d6724efeb8
Revises: b890ed51cfa6
Create Date: 2020-06-04 16:13:09.220452

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '28d6724efeb8'
down_revision = 'b890ed51cfa6'
branch_labels = None
depends_on = None


def upgrade(engine_name):
    globals()["upgrade_%s" % engine_name]()


def downgrade(engine_name):
    globals()["downgrade_%s" % engine_name]()





def upgrade_():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table('doctemplate',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('interest_id', sa.Integer(), nullable=True),
    sa.Column('templatename', sa.String(length=32), nullable=True),
    sa.Column('template', sa.Text(), nullable=True),
    sa.Column('version_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['interest_id'], ['localinterest.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('meeting',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('interest_id', sa.Integer(), nullable=True),
    sa.Column('purpose', sa.String(length=512), nullable=True),
    sa.Column('date', sa.Date(), nullable=True),
    sa.Column('version_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['interest_id'], ['localinterest.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('tag',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('interest_id', sa.Integer(), nullable=True),
    sa.Column('tag', sa.String(length=32), nullable=True),
    sa.Column('description', sa.String(length=512), nullable=True),
    sa.Column('version_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['interest_id'], ['localinterest.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('agendaitem',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('interest_id', sa.Integer(), nullable=True),
    sa.Column('meeting_id', sa.Integer(), nullable=True),
    sa.Column('order', sa.Integer(), nullable=True),
    sa.Column('title', sa.String(length=128), nullable=True),
    sa.Column('agendaitem', sa.Text(), nullable=True),
    sa.Column('version_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['interest_id'], ['localinterest.id'], ),
    sa.ForeignKeyConstraint(['meeting_id'], ['meeting.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('invite',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('interest_id', sa.Integer(), nullable=True),
    sa.Column('user_id', sa.Integer(), nullable=True),
    sa.Column('meeting_id', sa.Integer(), nullable=True),
    sa.Column('attending', sa.Boolean(), nullable=True),
    sa.Column('version_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['interest_id'], ['localinterest.id'], ),
    sa.ForeignKeyConstraint(['meeting_id'], ['meeting.id'], ),
    sa.ForeignKeyConstraint(['user_id'], ['localuser.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('localuser_tag',
    sa.Column('localuser_id', sa.Integer(), nullable=True),
    sa.Column('tag_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['localuser_id'], ['localuser.id'], ),
    sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], )
    )
    op.create_table('position_tag',
    sa.Column('position_id', sa.Integer(), nullable=True),
    sa.Column('tag_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['position_id'], ['position.id'], ),
    sa.ForeignKeyConstraint(['tag_id'], ['tag.id'], )
    )
    op.create_table('statusreport',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('interest_id', sa.Integer(), nullable=True),
    sa.Column('meeting_id', sa.Integer(), nullable=True),
    sa.Column('order', sa.Integer(), nullable=True),
    sa.Column('title', sa.String(length=128), nullable=True),
    sa.Column('statusreport', sa.Text(), nullable=True),
    sa.Column('version_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['interest_id'], ['localinterest.id'], ),
    sa.ForeignKeyConstraint(['meeting_id'], ['meeting.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    op.create_table('actionitem',
    sa.Column('id', sa.Integer(), nullable=False),
    sa.Column('interest_id', sa.Integer(), nullable=True),
    sa.Column('meeting_id', sa.Integer(), nullable=True),
    sa.Column('agendaitem_id', sa.Integer(), nullable=True),
    sa.Column('order', sa.Integer(), nullable=True),
    sa.Column('assignee_id', sa.Integer(), nullable=True),
    sa.Column('action', sa.Text(), nullable=True),
    sa.Column('status', sa.Enum('open', 'inprogress', 'closed'), nullable=True),
    sa.Column('comments', sa.Text(), nullable=True),
    sa.Column('version_id', sa.Integer(), nullable=False),
    sa.ForeignKeyConstraint(['agendaitem_id'], ['agendaitem.id'], ),
    sa.ForeignKeyConstraint(['assignee_id'], ['localuser.id'], ),
    sa.ForeignKeyConstraint(['interest_id'], ['localinterest.id'], ),
    sa.ForeignKeyConstraint(['meeting_id'], ['meeting.id'], ),
    sa.PrimaryKeyConstraint('id')
    )
    # ### end Alembic commands ###


def downgrade_():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('actionitem')
    op.drop_table('statusreport')
    op.drop_table('position_tag')
    op.drop_table('localuser_tag')
    op.drop_table('invite')
    op.drop_table('agendaitem')
    op.drop_table('tag')
    op.drop_table('meeting')
    op.drop_table('doctemplate')
    # ### end Alembic commands ###


def upgrade_users():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###


def downgrade_users():
    # ### commands auto generated by Alembic - please adjust! ###
    pass
    # ### end Alembic commands ###

