[Fix] User deletion & migration

This commit is contained in:
Alex 2026-08-09 02:50:54 +02:00
commit 19d97e4555
14 changed files with 456 additions and 148 deletions

View file

@ -0,0 +1,11 @@
ALTER TABLE users
DROP FOREIGN KEY fk_users_iota;
ALTER TABLE users
MODIFY iota_id BIGINT NULL;
ALTER TABLE users
ADD CONSTRAINT fk_users_iota
FOREIGN KEY (iota_id)
REFERENCES iotas (id)
ON DELETE SET NULL;

View file

@ -0,0 +1,8 @@
CREATE TABLE pending_iota_user_erasure (
user_id BIGINT NOT NULL,
iota_id BIGINT NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (user_id, iota_id),
CONSTRAINT fk_pending_iota_user_erasure_iota
FOREIGN KEY (iota_id) REFERENCES iotas(id) ON DELETE CASCADE
);