From 98d425f1f40d90078f9efb7a613207f7875293e0 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 20 Mar 2023 10:44:35 +1030 Subject: [PATCH] wallet: add comment on db noting that `ON DELETE CASCADE` is never used. We actually have an assertion that there are no channels remaining when we delete peers, so this is confusing! Actually removing the constraint is db-specific and deeply non-trivial. Signed-off-by: Rusty Russell --- wallet/db.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wallet/db.c b/wallet/db.c index f81c75449..ac847660d 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -96,6 +96,8 @@ static struct migration dbmigrations[] = { NULL}, {SQL("CREATE TABLE channels (" " id BIGSERIAL," /* chan->id */ + /* FIXME: We deliberately never delete a peer with channels, so this constraint is + * unnecessary! */ " peer_id BIGINT REFERENCES peers(id) ON DELETE CASCADE," " short_channel_id TEXT," " channel_config_local BIGINT,"