mirror of
https://github.com/juanfont/headscale.git
synced 2026-04-19 23:31:31 +02:00
hscontrol/db: add migration to clear user_id on tagged nodes
Tagged nodes are owned by their tags, not a user. Previously user_id was kept as "created by" tracking, but this prevents deleting users whose nodes have all been tagged, and the ON DELETE CASCADE FK would destroy the tagged nodes. Add a migration that sets user_id = NULL on all existing tagged nodes. Subsequent commits enforce this invariant at write time. Updates #3077
This commit is contained in:
@@ -79,6 +79,8 @@ CREATE TABLE nodes(
|
||||
ipv6 text,
|
||||
hostname text,
|
||||
given_name varchar(63),
|
||||
-- user_id is NULL for tagged nodes (owned by tags, not a user).
|
||||
-- Only set for user-owned nodes (no tags).
|
||||
user_id integer,
|
||||
register_method text,
|
||||
tags text,
|
||||
|
||||
Reference in New Issue
Block a user