fix: cascade channel_messages on packet delete

This commit is contained in:
MrAlders0n authored and Ded committed 2026-08-11 12:59:10 -07:00
1 parent b44cae89d7
commit c6d23a2b52
1 file changed
+12
@@ -0,0 +1,12 @@
-- Copyright 2026 Beacon Contributors
-- SPDX-License-Identifier: AGPL-3.0-or-later
-- The packet_hash FK had no ON DELETE action, so packets carrying a channel
-- message could never age out and DeleteOldPackets aborted. Match packet_observations.
ALTER TABLE channel_messages
DROP CONSTRAINT IF EXISTS channel_messages_packet_hash_fkey;
ALTER TABLE channel_messages
ADD CONSTRAINT channel_messages_packet_hash_fkey
FOREIGN KEY (packet_hash) REFERENCES packets(packet_hash) ON DELETE CASCADE;