YoloFace-BE/alembic/versions/a41d2f3443c8_face_image.py
2024-11-08 19:57:23 +08:00

64 lines
1.7 KiB
Python

"""face_image
Revision ID: a41d2f3443c8
Revises: 1d50ca81be81
Create Date: 2024-11-08 16:20:23.106957
"""
from alembic import op
import sqlalchemy as sa
import sqlmodel
# revision identifiers, used by Alembic.
revision = "a41d2f3443c8"
down_revision = "1d50ca81be81"
branch_labels = None
depends_on = None
def upgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"face_image",
sa.Column("delete_time", sa.DateTime(), nullable=True),
sa.Column(
"update_time",
sa.DateTime(),
server_default=sa.text("now()"),
nullable=True,
),
sa.Column("create_time", sa.DateTime(), nullable=False),
sa.Column("id", sa.Integer(), autoincrement=True, nullable=False),
sa.Column(
"image",
sqlmodel.sql.sqltypes.AutoString(length=255),
nullable=False,
),
sa.Column("is_approved", sa.Boolean(), nullable=False),
sa.Column("user_id", sa.Integer(), nullable=False),
sa.PrimaryKeyConstraint("id"),
)
op.create_index(
op.f("ix_face_image_create_time"),
"face_image",
["create_time"],
unique=False,
)
op.create_index(
op.f("ix_face_image_update_time"),
"face_image",
["update_time"],
unique=False,
)
# ### end Alembic commands ###
def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(op.f("ix_face_image_update_time"), table_name="face_image")
op.drop_index(op.f("ix_face_image_create_time"), table_name="face_image")
op.drop_table("face_image")
# ### end Alembic commands ###