"""empty message

Revision ID: a336ac384c64
Revises: 62e071b0da50
Create Date: 2020-07-31 16:30:19.185088

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

from project import dbtypes

# revision identifiers, used by Alembic.
revision = "a336ac384c64"
down_revision = "62e071b0da50"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "eventcontact",
        sa.Column("created_at", sa.DateTime(), nullable=True),
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.Unicode(length=255), nullable=False),
        sa.Column("email", sa.Unicode(length=255), nullable=True),
        sa.Column("phone", sa.Unicode(length=255), nullable=True),
        sa.Column("created_by_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(
            ["created_by_id"],
            ["user.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.add_column("event", sa.Column("contact_id", sa.Integer(), nullable=True))
    op.create_foreign_key(None, "event", "eventcontact", ["contact_id"], ["id"])
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_constraint(None, "event", type_="foreignkey")
    op.drop_column("event", "contact_id")
    op.drop_table("eventcontact")
    # ### end Alembic commands ###
