"""cart_coupon table

Revision ID: e12bbe39d87e
Revises: f3aa57777025
Create Date: 2020-08-23 12:48:47.259833

"""

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "e12bbe39d87e"
down_revision = "f3aa57777025"
branch_labels = None
depends_on = None

from make_post_sell.models.meta import UUIDType


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "mps_cart_coupon",
        sa.Column("id", UUIDType, nullable=False),
        sa.Column("cart_id", UUIDType, nullable=False),
        sa.Column("coupon_id", UUIDType, nullable=False),
        sa.Column("created_timestamp", sa.BigInteger(), nullable=False),
        sa.ForeignKeyConstraint(
            ["cart_id"],
            ["mps_cart.id"],
        ),
        sa.ForeignKeyConstraint(
            ["coupon_id"],
            ["mps_coupon.id"],
        ),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_index(
        op.f("ix_mps_cart_coupon_id"), "mps_cart_coupon", ["id"], unique=False
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_index(op.f("ix_mps_cart_coupon_id"), table_name="mps_cart_coupon")
    op.drop_table("mps_cart_coupon")
    # ### end Alembic commands ###
