"""Added Role Menu

Revision ID: 42510fc13e04
Revises: 49eb6e4220ef
Create Date: 2022-09-21 19:49:56.168412

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "42510fc13e04"
down_revision = "49eb6e4220ef"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "rolemenu",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("msg_ref", sa.String(), nullable=False),
        sa.Column("guild_id", sa.BigInteger(), nullable=False),
        sa.Column("title", sa.String(), server_default="Vote", nullable=False),
        sa.Column("channel_id", sa.BigInteger(), nullable=False),
        sa.Column("message_id", sa.BigInteger(), nullable=True),
        sa.PrimaryKeyConstraint("id"),
        sa.UniqueConstraint("msg_ref", "guild_id"),
    )
    op.create_table(
        "roleentry",
        sa.Column("menu_id", sa.Integer(), nullable=False),
        sa.Column("role", sa.BigInteger(), nullable=False),
        sa.Column("title", sa.String(), nullable=False),
        sa.Column("description", sa.String(), nullable=True),
        sa.Column("emoji", sa.String(), nullable=True),
        sa.ForeignKeyConstraint(["menu_id"], ["rolemenu.id"], ondelete="CASCADE"),
        sa.PrimaryKeyConstraint("menu_id", "role"),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("roleentry")
    op.drop_table("rolemenu")
    # ### end Alembic commands ###
