56 lines
1.8 KiB
Python
56 lines
1.8 KiB
Python
"""add attachment_points
|
|
|
|
Revision ID: adf4a5b9493e
|
|
Revises: 70e48bda8829
|
|
Create Date: 2026-07-02 14:03:23.561253
|
|
"""
|
|
|
|
from typing import Sequence, Union
|
|
|
|
from alembic import op
|
|
import sqlalchemy as sa
|
|
|
|
# revision identifiers, used by Alembic.
|
|
revision: str = "adf4a5b9493e"
|
|
down_revision: Union[str, None] = "70e48bda8829"
|
|
branch_labels: Union[str, Sequence[str], None] = None
|
|
depends_on: Union[str, Sequence[str], None] = None
|
|
|
|
|
|
def upgrade() -> None:
|
|
op.create_table(
|
|
"attachment_points",
|
|
sa.Column("id", sa.Integer(), nullable=False),
|
|
sa.Column("augmented_part_id", sa.Integer(), nullable=False),
|
|
sa.Column("attachment_point_name_id", sa.Integer(), nullable=False),
|
|
sa.Column("iso_thread_id", sa.Integer(), nullable=True),
|
|
sa.Column("unc_thread_id", sa.Integer(), nullable=True),
|
|
sa.Column("clamp_connection_id", sa.Integer(), nullable=True),
|
|
sa.Column("static_connection_id", sa.Integer(), nullable=True),
|
|
sa.ForeignKeyConstraint(
|
|
["augmented_part_id"], ["augmented_parts.id"], ondelete="CASCADE"
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["attachment_point_name_id"],
|
|
["attachment_point_names.id"],
|
|
ondelete="RESTRICT",
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["iso_thread_id"], ["iso_threads.id"], ondelete="RESTRICT"
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["unc_thread_id"], ["unc_threads.id"], ondelete="RESTRICT"
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["clamp_connection_id"], ["clamp_connections.id"], ondelete="RESTRICT"
|
|
),
|
|
sa.ForeignKeyConstraint(
|
|
["static_connection_id"], ["static_connections.id"], ondelete="RESTRICT"
|
|
),
|
|
sa.PrimaryKeyConstraint("id"),
|
|
)
|
|
|
|
|
|
def downgrade() -> None:
|
|
op.drop_table("attachment_points")
|