fix: Remove FK constraint from location migration for SQLite compatibility
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled
Issue Manager / issue-manager (push) Has been cancelled
Some checks failed
CI / style (push) Has been cancelled
CI / build-client (push) Has been cancelled
CI / build-amd64 (push) Has been cancelled
CI / build-tester (push) Has been cancelled
CI / test (cockroachdb) (push) Has been cancelled
CI / test (mariadb) (push) Has been cancelled
CI / test (postgres) (push) Has been cancelled
CI / test (sqlite) (push) Has been cancelled
CI / build-arm64 (push) Has been cancelled
CI / build-armv7 (push) Has been cancelled
CI / publish-images (push) Has been cancelled
CI / publish-release (push) Has been cancelled
Issue Manager / issue-manager (push) Has been cancelled
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user