fix(server): revert migration 008 comment edit — modifying an applied sqlx migration breaks its checksum and crash-loops the server on startup; machines.rs ON CONFLICT fix retained
All checks were successful
All checks were successful
This commit is contained in:
@@ -34,12 +34,8 @@ ALTER TABLE connect_machines ADD COLUMN IF NOT EXISTS machine_uid TEXT;
|
||||
|
||||
-- 2. Enforce one row per machine_uid, but ONLY for rows that actually have one.
|
||||
-- A partial UNIQUE index (WHERE machine_uid IS NOT NULL) lets unlimited legacy
|
||||
-- NULL rows coexist while making a non-null machine_uid a true dedup key. Because
|
||||
-- this index is PARTIAL, Postgres only binds an ON CONFLICT inference clause to it
|
||||
-- when the clause REPEATS the same predicate: upsert_machine's arbiter must be
|
||||
-- `ON CONFLICT (machine_uid) WHERE machine_uid IS NOT NULL` (a bare
|
||||
-- `ON CONFLICT (machine_uid)` raises "no unique or exclusion constraint matching
|
||||
-- the ON CONFLICT specification" at runtime and persists no row).
|
||||
-- NULL rows coexist while making a non-null machine_uid a true dedup key — this
|
||||
-- is what upsert_machine's `ON CONFLICT (machine_uid)` arbiter binds to.
|
||||
CREATE UNIQUE INDEX IF NOT EXISTS idx_connect_machines_machine_uid
|
||||
ON connect_machines (machine_uid)
|
||||
WHERE machine_uid IS NOT NULL;
|
||||
|
||||
Reference in New Issue
Block a user