Skip to content

[Bug]: Cannot delete a site that has QR codes #248

Closed

Description

@PascaleBeier

Summary

Deleting a site fails when the site has one or more QR codes because the cleanup routine violates a QR-code foreign key constraint.

Environment

  • Product/Service: HitKeep dashboard — site administration
  • Region/Version: Self-hosted/current development version
  • Browser/OS: Not browser-specific

Reproduction Steps

  1. Create a site.
  2. Create a QR campaign and QR code for that site.
  3. Attempt to delete the site from site settings.
  4. Observe that the deletion fails.

Expected Behavior

The site and all site-scoped QR campaign data are deleted successfully.

Actual Behavior

The site deletion fails while updating or removing the site's QR-code relationships. The QR code is still referenced by another QR-related table, so DuckDB rejects the operation.

Error Details

could not update site foreign key qr_codes.site_id: Constraint Error:
Violates foreign key constraint because key "qr_code_id: [QR_CODE_ID]"
is still referenced by a foreign key in a different table.

Visual Evidence

Not applicable; the backend constraint error is sufficient to reproduce the failure.

Impact

Medium — Sites containing QR codes cannot be deleted through the supported workflow.

Release Notes

Fixed site deletion failing for sites that contain QR codes.

Docs Impact

Not needed.

Additional Context

The same foreign-key ordering problem can also surface when renaming a site's domain because both operations use shared site cleanup/transfer routines. DuckDB does not support cascading deletes or deferred constraints, so dependent QR rows must be handled before rewriting or deleting the parent QR-code rows.

Activity

  1. added
    bug
    on Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions