Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #476 : delete dangling build artifacts before migration #477

Merged
merged 1 commit into from
May 2, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,16 @@ def upgrade():
"build_environment_id_fkey", "environment", ["environment_id"], ["id"]
)

# One case of data inconsistency has been identified, that makes the migration fail :
# Dangling build artifacts : rows in table `build_artifact` with a `build_id`` that doesn't exists anymore.
# see issue https://github.com/Quansight/conda-store/issues/476
# Fix : delete dangling artifacts
op.execute(
""" DELETE FROM build_artifact
WHERE build_id NOT IN (SELECT DISTINCT(id) FROM build)
"""
)

with op.batch_alter_table("build_artifact") as batch_op:
batch_op.create_foreign_key(
"build_artifact_build_id_fkey", "build", ["build_id"], ["id"]
Expand Down