[Fix] Stability
This commit is contained in:
parent
fa0af21af5
commit
4f7260419a
20 changed files with 563 additions and 464 deletions
13
migrations/002_registration_leases.sql
Normal file
13
migrations/002_registration_leases.sql
Normal 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)
|
||||
);
|
||||
Loading…
Reference in a new issue