feat(estimates): integrate inventory items
This commit is contained in:
parent
fb5c2cc26a
commit
663bdc41b1
15 changed files with 629 additions and 28 deletions
|
|
@ -0,0 +1,44 @@
|
|||
"""extend repair estimate items inventory
|
||||
|
||||
Revision ID: f4a9c2d7e118
|
||||
Revises: ef8a2d5c9017
|
||||
Create Date: 2026-07-05 13:00:00.000000
|
||||
|
||||
"""
|
||||
from typing import Sequence, Union
|
||||
|
||||
from alembic import op
|
||||
import sqlalchemy as sa
|
||||
|
||||
|
||||
revision: str = "f4a9c2d7e118"
|
||||
down_revision: Union[str, Sequence[str], None] = "ef8a2d5c9017"
|
||||
branch_labels: Union[str, Sequence[str], None] = None
|
||||
depends_on: Union[str, Sequence[str], None] = None
|
||||
|
||||
|
||||
def upgrade() -> None:
|
||||
op.add_column("repair_estimate_items", sa.Column("inventory_item_id", sa.Integer(), nullable=True))
|
||||
op.add_column("repair_estimate_items", sa.Column("inventory_snapshot_name", sa.String(length=255), server_default="", nullable=False))
|
||||
op.add_column("repair_estimate_items", sa.Column("inventory_snapshot_sku", sa.String(length=40), server_default="", nullable=False))
|
||||
op.add_column("repair_estimate_items", sa.Column("inventory_snapshot_manufacturer", sa.String(length=180), nullable=True))
|
||||
op.add_column("repair_estimate_items", sa.Column("inventory_snapshot_part_number", sa.String(length=180), nullable=True))
|
||||
op.create_index(op.f("ix_repair_estimate_items_inventory_item_id"), "repair_estimate_items", ["inventory_item_id"], unique=False)
|
||||
op.create_foreign_key(
|
||||
"fk_repair_estimate_items_inventory_item_id",
|
||||
"repair_estimate_items",
|
||||
"inventory_items",
|
||||
["inventory_item_id"],
|
||||
["id"],
|
||||
ondelete="SET NULL",
|
||||
)
|
||||
|
||||
|
||||
def downgrade() -> None:
|
||||
op.drop_constraint("fk_repair_estimate_items_inventory_item_id", "repair_estimate_items", type_="foreignkey")
|
||||
op.drop_index(op.f("ix_repair_estimate_items_inventory_item_id"), table_name="repair_estimate_items")
|
||||
op.drop_column("repair_estimate_items", "inventory_snapshot_part_number")
|
||||
op.drop_column("repair_estimate_items", "inventory_snapshot_manufacturer")
|
||||
op.drop_column("repair_estimate_items", "inventory_snapshot_sku")
|
||||
op.drop_column("repair_estimate_items", "inventory_snapshot_name")
|
||||
op.drop_column("repair_estimate_items", "inventory_item_id")
|
||||
Loading…
Add table
Add a link
Reference in a new issue