"""empty message

Revision ID: de316f0831f9
Revises: 6<PASSWORD>1e462e9
Create Date: 2021-11-19 23:38:39.754126

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

# revision identifiers, used by Alembic.
revision = "de316f0831f9"
down_revision = "60f151e462e9"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###

    sale_type = postgresql.ENUM(
        "SALE_IN_PIX",
        "SALE_IN_DEBT",
        "SALE_IN_CREDIT",
        "SALE_IN_MONEY",
        "SALE_IN_TRANSFER",
        "SALE_IN_BILLET",
        "SALE_OTHERS",
        name="saletype",
    )
    sale_type.create(op.get_bind())
    op.add_column(
        "orders",
        sa.Column(
            "sale_type",
            sa.Enum(
                "SALE_IN_PIX",
                "SALE_IN_DEBT",
                "SALE_IN_CREDIT",
                "SALE_IN_MONEY",
                "SALE_IN_TRANSFER",
                "SALE_IN_BILLET",
                "SALE_OTHERS",
                name="saletype",
            ),
            nullable=True,
        ),
    )

    op.drop_index("ix_balance_operation", table_name="balance")
    op.drop_index("ix_balance_type", table_name="balance")
    op.drop_column("balance", "type")
    op.alter_column("clients", "email", existing_type=sa.VARCHAR(), nullable=False)
    op.alter_column("clients", "phone", existing_type=sa.VARCHAR(), nullable=False)
    op.alter_column("clients", "owner_id", existing_type=postgresql.UUID(), nullable=False)

    op.alter_column("orders", "owner_id", existing_type=postgresql.UUID(), nullable=False)
    op.add_column("clients", sa.Column("zip_code", sqlmodel.sql.sqltypes.AutoString(), nullable=True))
    op.add_column("clients", sa.Column("address", 