"""Init migration

Revision ID: 9edeb1ae275f
Revises:
Create Date: 2021-07-30 15:35:06.451493

"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = "9edeb1ae275f"
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "photo",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("array", sa.PickleType(), nullable=True),
        sa.Column("width", sa.Integer(), nullable=False),
        sa.Column("height", sa.Integer(), nullable=False),
        sa.PrimaryKeyConstraint("id"),
        sa.UniqueConstraint("array"),
    )
    op.create_table(
        "profile",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("name", sa.String(length=100), nullable=False),
        sa.Column("thumbnail_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(["thumbnail_id"], ["photo.id"]),
        sa.PrimaryKeyConstraint("id"),
    )
    op.create_table(
        "face",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("location", sa.PickleType(), nullable=False),
        sa.Column("landmarks", sa.PickleType(), nullable=False),
        sa.Column("encoding", sa.PickleType(), nullable=False),
        sa.Column("profile_id", sa.Integer(), nullable=True),
        sa.Column("photo_id", sa.Integer(), nullable=True),
        sa.ForeignKeyConstraint(["photo_id"], ["photo.id"]),
        sa.ForeignKeyConstraint(["profile_id"], ["profile.id"]),
        sa.PrimaryKeyConstraint("id"),
    )
    # ### end Alembic commands ###


def downgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("face")
    op.drop_table("profile")
    op.drop_table("photo")
    # ### end Alembic commands ###
