[Fix] Stability

This commit is contained in:
Alex 2026-07-27 20:36:23 +02:00
commit 4f7260419a
20 changed files with 563 additions and 464 deletions

View file

@ -0,0 +1,13 @@
-- Registration IDs are allocated before the user row is created. Keep the
-- allocation durable and bound to the Iota that requested it so a completed
-- registration can safely be retried after any response is lost.
CREATE TABLE registration_leases (
token CHAR(36) CHARACTER SET ascii COLLATE ascii_bin NOT NULL PRIMARY KEY,
user_id BIGINT NOT NULL UNIQUE,
iota_id BIGINT NOT NULL,
expires_at DATETIME NOT NULL,
completed_at DATETIME NULL,
CONSTRAINT fk_registration_leases_iota
FOREIGN KEY (iota_id) REFERENCES iotas (id),
INDEX idx_registration_leases_expiry (expires_at)
);