mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-09-27 20:38:32 +02:00
fixes a bug with deleting connectors and foreign keys (#2398)
This commit is contained in:
@@ -335,6 +335,16 @@ def delete_index_attempts(
|
||||
cc_pair_id: int,
|
||||
db_session: Session,
|
||||
) -> None:
|
||||
# First, delete related entries in IndexAttemptErrors
|
||||
stmt_errors = delete(IndexAttemptError).where(
|
||||
IndexAttemptError.index_attempt_id.in_(
|
||||
select(IndexAttempt.id).where(
|
||||
IndexAttempt.connector_credential_pair_id == cc_pair_id
|
||||
)
|
||||
)
|
||||
)
|
||||
db_session.execute(stmt_errors)
|
||||
|
||||
stmt = delete(IndexAttempt).where(
|
||||
IndexAttempt.connector_credential_pair_id == cc_pair_id,
|
||||
)
|
||||
|
Reference in New Issue
Block a user