diff --git a/migrations/versions/2025_01_21_0100-e5f6g7h8i9j0_add_hierarchical_locations.py b/migrations/versions/2025_01_21_0100-e5f6g7h8i9j0_add_hierarchical_locations.py index 40bca33..677551f 100644 --- a/migrations/versions/2025_01_21_0100-e5f6g7h8i9j0_add_hierarchical_locations.py +++ b/migrations/versions/2025_01_21_0100-e5f6g7h8i9j0_add_hierarchical_locations.py @@ -35,26 +35,17 @@ def upgrade() -> None: op.create_index(op.f("ix_location_id"), "location", ["id"], unique=False) op.create_index(op.f("ix_location_parent_id"), "location", ["parent_id"], unique=False) - # Add location_id column to spool table + # Add location_id column to spool table (SQLite compatible - no FK constraint) op.add_column( "spool", sa.Column("location_id", sa.Integer(), nullable=True), ) - op.create_foreign_key( - "fk_spool_location_id", - "spool", - "location", - ["location_id"], - ["id"], - ondelete="SET NULL", - ) op.create_index(op.f("ix_spool_location_id"), "spool", ["location_id"], unique=False) def downgrade() -> None: """Drop location table and remove location_id from spool.""" op.drop_index(op.f("ix_spool_location_id"), table_name="spool") - op.drop_constraint("fk_spool_location_id", "spool", type_="foreignkey") op.drop_column("spool", "location_id") op.drop_index(op.f("ix_location_parent_id"), table_name="location") op.drop_index(op.f("ix_location_id"), table_name="location")