update models: TripItem attachments
This commit is contained in:
parent
5c977bdf2f
commit
8f671afb58
@ -0,0 +1,52 @@
|
|||||||
|
"""TripItem attachments
|
||||||
|
|
||||||
|
Revision ID: c6bf10b10d0a
|
||||||
|
Revises: e75fca7d8759
|
||||||
|
Create Date: 2025-11-01 23:12:29.691502
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
import sqlalchemy as sa
|
||||||
|
import sqlmodel.sql.sqltypes
|
||||||
|
from alembic import op
|
||||||
|
|
||||||
|
# revision identifiers, used by Alembic.
|
||||||
|
revision = "c6bf10b10d0a"
|
||||||
|
down_revision = "e75fca7d8759"
|
||||||
|
branch_labels = None
|
||||||
|
depends_on = None
|
||||||
|
|
||||||
|
|
||||||
|
def upgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
op.create_table(
|
||||||
|
"tripitemattachmentlink",
|
||||||
|
sa.Column("item_id", sa.Integer(), nullable=False),
|
||||||
|
sa.Column("attachment_id", sa.Integer(), nullable=False),
|
||||||
|
sa.ForeignKeyConstraint(
|
||||||
|
["attachment_id"],
|
||||||
|
["tripattachment.id"],
|
||||||
|
name=op.f("fk_tripitemattachmentlink_attachment_id_tripattachment"),
|
||||||
|
ondelete="CASCADE",
|
||||||
|
),
|
||||||
|
sa.ForeignKeyConstraint(
|
||||||
|
["item_id"],
|
||||||
|
["tripitem.id"],
|
||||||
|
name=op.f("fk_tripitemattachmentlink_item_id_tripitem"),
|
||||||
|
ondelete="CASCADE",
|
||||||
|
),
|
||||||
|
sa.PrimaryKeyConstraint("item_id", "attachment_id", name=op.f("pk_tripitemattachmentlink")),
|
||||||
|
)
|
||||||
|
with op.batch_alter_table("tripitemattachmentlink", schema=None) as batch_op:
|
||||||
|
batch_op.create_index(batch_op.f("ix_tripitemattachmentlink_item_id"), ["item_id"], unique=False)
|
||||||
|
|
||||||
|
# ### end Alembic commands ###
|
||||||
|
|
||||||
|
|
||||||
|
def downgrade():
|
||||||
|
# ### commands auto generated by Alembic - please adjust! ###
|
||||||
|
with op.batch_alter_table("tripitemattachmentlink", schema=None) as batch_op:
|
||||||
|
batch_op.drop_index(batch_op.f("ix_tripitemattachmentlink_item_id"))
|
||||||
|
|
||||||
|
op.drop_table("tripitemattachmentlink")
|
||||||
|
# ### end Alembic commands ###
|
||||||
Loading…
x
Reference in New Issue
Block a user