# SPDX-FileCopyrightText: 2023 Marlon W (Mawoka)
#
# SPDX-License-Identifier: MPL-2.0

"""Added quiztivityshares

Revision ID: 8ac2bed1718e
Revises: 4bbe1850b61a
Create Date: 2023-05-14 12:04:03.639173

"""
from alembic import op
import sqlalchemy as sa
import ormar


# revision identifiers, used by Alembic.
revision = "8ac2bed1718e"
down_revision = "4bbe1850b61a"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "quiztivityshares",
        sa.Column("id", ormar.fields.sqlalchemy_uuid.CHAR(32), nullable=False),
        sa.Column("name", sa.Text(), nullable=True),
        sa.Column("expire_at", sa.DateTime(), nullable=True),
        sa.Column("quiztivity", ormar.fields.sqlalchemy_uuid.CHAR(32), nullable=True),
        sa.Column("user", ormar.fields.sqlalchemy_uuid.CHAR(32), nullable=True),
        sa.ForeignKeyConstraint(
            ["quiztivity"], ["quiztivitys.id"], name="fk_quiztivityshares_quiztivitys_id_quiztivity"
        ),
        sa.ForeignKeyConstraint(["user"], ["users.id"], name="fk_quiztivityshares_users_id_user"),
        sa.PrimaryKeyConstraint("id"),
    )
    # ### end Alembic commands ###


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