Files
fitguide/alembic/versions/bfbce324cd5f_add_augmented_part_imported_parts.py
T

37 lines
1.0 KiB
Python

"""add augmented_part_imported_parts
Revision ID: bfbce324cd5f
Revises: 8bc411b5814e
Create Date: 2026-07-02 12:46:27.493942
"""
from typing import Sequence, Union
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision: str = "bfbce324cd5f"
down_revision: Union[str, None] = "8bc411b5814e"
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
def upgrade() -> None:
op.create_table(
"augmented_part_imported_parts",
sa.Column("augmented_part_id", sa.Integer(), nullable=False),
sa.Column("imported_part_id", sa.String(), nullable=False),
sa.ForeignKeyConstraint(
["augmented_part_id"], ["augmented_parts.id"], ondelete="CASCADE"
),
sa.ForeignKeyConstraint(
["imported_part_id"], ["imported_parts.InventoryID"], ondelete="CASCADE"
),
sa.PrimaryKeyConstraint("augmented_part_id", "imported_part_id"),
)
def downgrade() -> None:
op.drop_table("augmented_part_imported_parts")