38 lines
1.0 KiB
Python
38 lines
1.0 KiB
Python
"""TripItem image
|
|
|
|
Revision ID: 8775a65d510f
|
|
Revises: 7e331b851cb7
|
|
Create Date: 2025-09-20 20:01:43.884115
|
|
|
|
"""
|
|
|
|
import sqlalchemy as sa
|
|
import sqlmodel.sql.sqltypes
|
|
from alembic import op
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision = "8775a65d510f"
|
|
down_revision = "7e331b851cb7"
|
|
branch_labels = None
|
|
depends_on = None
|
|
|
|
|
|
def upgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table("tripitem", schema=None) as batch_op:
|
|
batch_op.add_column(sa.Column("image_id", sa.Integer(), nullable=True))
|
|
batch_op.create_foreign_key(
|
|
batch_op.f("fk_tripitem_image_id_image"), "image", ["image_id"], ["id"], ondelete="CASCADE"
|
|
)
|
|
|
|
# ### end Alembic commands ###
|
|
|
|
|
|
def downgrade():
|
|
# ### commands auto generated by Alembic - please adjust! ###
|
|
with op.batch_alter_table("tripitem", schema=None) as batch_op:
|
|
batch_op.drop_constraint(batch_op.f("fk_tripitem_image_id_image"), type_="foreignkey")
|
|
batch_op.drop_column("image_id")
|
|
|
|
# ### end Alembic commands ###
|