"""store provider complaints

Revision ID: 28b9b14c9664
Revises: b500363567e3
Create Date: 2022-05-03 14:14:23.288929

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


# revision identifiers, used by Alembic.
revision = "28b9b14c9664"
down_revision = "b500363567e3"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "provider_complaint",
        sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
        sa.Column(
            "created_at", sqlalchemy_utils.types.arrow.ArrowType(), nullable=False
        ),
        sa.Column(
            "updated_at", sqlalchemy_utils.types.arrow.ArrowType(), nullable=True
        ),
        sa.Column("user_id", sa.Integer(), nullable=False),
        sa.Column("state", sa.Integer(), server_default="0", nullable=False),
        sa.Column("phase", sa.Integer(), server_default="0", nullable=False),
        sa.Column("refused_email_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["refused_email_id"], ["refused_email.id"], ondelete="cascade"
        ),
        sa.ForeignKeyConstraint(
            ["user_id"],
            ["users.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    # ### end Alembic commands ###


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