"""empty message

Revision ID: <KEY>
Revises: 6<PASSWORD>
Create Date: 2020-02-18 04:20:50.438617

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

# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "68dbae3184e0"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("celebrities", sa.Column("image_id", sa.INTEGER(), nullable=True))
    op.create_foreign_key(None, "celebrities", "images", ["image_id"], ["id"])
    op.drop_column("celebrities", "avatar_url_last")
    op.add_column("images", sa.Column("ext", sa.String(length=8), nullable=True))
    op.drop_index("name", table_name="images")
    op.drop_column("images", "name")
    op.add_column("movies", sa.Column("image_id", sa.Integer(), nullable=False))
    op.create_foreign_key(None, "movies", "images", ["image_id"], ["id"])
    op.drop_column("movies", "image_url_last")
    op.add_column("users", sa.Column("avatar_image_id", sa.Integer(), nullable=True))
    op.create_foreign_key(None, "users", "images", ["avatar_image_id"], ["id"])
    op.drop_column("users", "avatar_url_last")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "users",
        sa.Column(
            "avatar_url_last",
            mysql.VARCHAR(collation="utf8mb4_bin", length=128),
            nullable=True,
        ),
    )
    op.drop_constraint(None, "users", type_="foreignkey")
    op.drop_column("users", "avatar_image_id")
    op.add_column(
        "movies",
        sa.Column(
            "image_url_last",
            mysql.VARCHAR(collation="utf8mb4_bin", length=128),
            nullable=False,
        ),
    )
    op.drop_constraint(None, "movies", type_="foreignkey")
    op.drop_column("movies", "image_id")
    op.add_column(
        "images",
        sa.Column(
            "name", mysql.VARCHAR(collation="utf8mb4_bin", length=20), nullable=True
        ),
    )
    op.create_index("name", "images", ["name"], unique=True)
    op.drop_column("images", "ext")
    op.add_column(
        "celebrities",
        sa.Column(
            "avatar_url_last",
            mysql.VARCHAR(collation="utf8mb4_bin", length=128),
            nullable=False,
        ),
    )
    op.drop_constraint(None, "celebrities", type_="foreignkey")
    op.drop_column("celebrities", "image_id")
    # ### end Alembic commands ###

"""empty message

Revision ID: <KEY>
Revises: 6<PASSWORD>
Create Date: 2020-02-18 04:20:50.438617

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

# revision identifiers, used by Alembic.
revision = "<KEY>"
down_revision = "68dbae3184e0"
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column("celebrities", sa.Column("image_id", sa.INTEGER(), nullable=True))
    op.create_foreign_key(None, "celebrities", "images", ["image_id"], ["id"])
    op.drop_column("celebrities", "avatar_url_last")
    op.add_column("images", sa.Column("ext", sa.String(length=8), nullable=True))
    op.drop_index("name", table_name="images")
    op.drop_column("images", "name")
    op.add_column("movies", sa.Column("image_id", sa.Integer(), nullable=False))
    op.create_foreign_key(None, "movies", "images", ["image_id"], ["id"])
    op.drop_column("movies", "image_url_last")
    op.add_column("users", sa.Column("avatar_image_id", sa.Integer(), nullable=True))
    op.create_foreign_key(None, "users", "images", ["avatar_image_id"], ["id"])
    op.drop_column("users", "avatar_url_last")
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.add_column(
        "users",
        sa.Column(
            "avatar_url_last",
            mysql.VARCHAR(collation="utf8mb4_bin", length=128),
            nullable=True,
        ),
    )
    op.drop_constraint(None, "users", type_="foreignkey")
    op.drop_column("users", "avatar_image_id")
    op.add_column(
        "movies",
        sa.Column(
            "image_url_last",
            mysql.VARCHAR(collation="utf8mb4_bin", length=128),
            nullable=False,
        ),
    )
    op.drop_constraint(None, "movies", type_="foreignkey")
    op.drop_column("movies", "image_id")
    op.add_column(
        "images",
        sa.Column(
            "name", mysql.VARCHAR(collation="utf8mb4_bin", length=20), nullable=True
        ),
    )
    op.create_index("name", "images", ["name"], unique=True)
    op.drop_column("images", "ext")
    op.add_column(
        "celebrities",
        sa.Column(
            "avatar_url_last",
            mysql.VARCHAR(collation="utf8mb4_bin", length=128),
            nullable=False,
        ),
    )
    op.drop_constraint(None, "celebrities", type_="foreignkey")
    op.drop_column("celebrities", "image_id")
    # ### end Alembic commands ###

empty message  Revision ID: <KEY> Revises: 6<PASSWORD> Create Date: 2020-02-18 04:20:50.438617 # revision identifiers, used by Alembic. # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ### # ### commands auto generated by Alembic - please adjust! ### # ### end Alembic commands ###