Automatically remove orphan files

This commit is contained in:
2025-04-09 21:51:23 +02:00
parent 6f18aafc33
commit 7c04acaf4b
5 changed files with 15 additions and 5 deletions

View File

@ -52,7 +52,7 @@ CREATE TABLE movements
account_id INTEGER NOT NULL REFERENCES accounts ON DELETE CASCADE,
time BIGINT NOT NULL,
label VARCHAR(200) NOT NULL,
file_id INT REFERENCES files ON DELETE SET NULL,
file_id INT REFERENCES files ON DELETE RESTRICT,
amount REAL NOT NULL,
checked BOOLEAN NOT NULL DEFAULT false,
time_create BIGINT NOT NULL,
@ -62,7 +62,7 @@ CREATE TABLE movements
CREATE TABLE inbox
(
id SERIAL PRIMARY KEY,
file_id INTEGER NOT NULL REFERENCES files ON DELETE CASCADE,
file_id INTEGER NOT NULL REFERENCES files ON DELETE RESTRICT,
user_id INTEGER NOT NULL REFERENCES users ON DELETE CASCADE,
account_id INTEGER REFERENCES accounts ON DELETE CASCADE,
time_create BIGINT NOT NULL,