"""empty message

Revision ID: dae4f6b7df58
Revises: f090ce3c1c58
Create Date: 2020-05-04 22:13:20.127247

"""
from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

# revision identifiers, used by Alembic.
revision = "dae4f6b7df58"
down_revision = "f090ce3c1c58"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("workshop_child")
    op.drop_table("workshop")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "workshop",
        sa.Column(
            "workshop_id",
            sa.INTEGER(),
            server_default=sa.text("nextval('workshop_workshop_id_seq'::regclass)"),
            autoincrement=True,
            nullable=False,
        ),
        sa.Column("instructor_id", sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column("status_id", sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column("category_id", sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column("description", sa.TEXT(), autoincrement=False, nullable=False),
        sa.Column("video_loc", sa.VARCHAR(), autoincrement=False, nullable=True),
        sa.Column("duration", sa.INTEGER(), autoincrement=False, nullable=True),
        sa.Column("max_class_size", sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column(
            "price",
            postgresql.DOUBLE_PRECISION(precision=53),
            autoincrement=False,
            nullable=False,
        ),
        sa.Column(
            "scheduled_dt", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
        ),
        sa.Column(
            "inserted_dt", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
        ),
        sa.Column(
            "updated_dt", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
        ),
        sa.ForeignKeyConstraint(
            ["category_id"], ["category.category_id"], name="workshop_category_id_fkey"
        ),
        sa.ForeignKeyConstraint(
            ["instructor_id"],
            ["instructor.instructor_id"],
            name="workshop_instructor_id_fkey",
        ),
        sa.ForeignKeyConstraint(
            ["status_id"], ["status.status_id"], name="workshop_status_id_fkey"
        ),
        sa.PrimaryKeyConstraint("workshop_id", name="workshop_pkey"),
        postgresql_ignore_search_path=False,
    )
    op.create_table(
        "workshop_child",
        sa.Column(
            "workshop_child_id", sa.INTEGER(), autoincrement=True, nullable=False
        ),
        sa.Column("workshop_id", sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column("child_id", sa.INTEGER(), autoincrement=False, nullable=False),
        sa.Column(
            "inserted_dt", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
        ),
        sa.Column(
            "updated_dt", postgresql.TIMESTAMP(), autoincrement=False, nullable=False
        ),
        sa.ForeignKeyConstraint(
            ["child_id"], ["child.child_id"], name="workshop_child_child_id_fkey"
        ),
        sa.ForeignKeyConstraint(
            ["workshop_id"],
            ["workshop.workshop_id"],
            name="workshop_child_workshop_id_fkey",
        ),
        sa.PrimaryKeyConstraint("workshop_child_id", name="workshop_child_pkey"),
    )
    # ### end Alembic commands ###
