23 lines
741 B
SQL
23 lines
741 B
SQL
CREATE TABLE app_uploader_files (
|
|
id UUID PRIMARY KEY UNIQUE NOT NULL DEFAULT gen_random_uuid(),
|
|
uid VARCHAR NOT NULL,
|
|
file_crypto VARCHAR NOT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
-- settings
|
|
expire TIMESTAMP NOT NULL,
|
|
max_visits INT NOT NULL,
|
|
FOREIGN KEY (uid) REFERENCES users (uid)
|
|
);
|
|
|
|
CREATE TABLE app_uploader_files_access (
|
|
file_id UUID NOT NULL,
|
|
-- info about user who accessed
|
|
uid VARCHAR DEFAULT NULL, -- link to logged in user
|
|
ip_address VARCHAR NOT NULL,
|
|
agent VARCHAR NOT NULL,
|
|
access_time TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
FOREIGN KEY (file_id) REFERENCES app_uploader_files (id),
|
|
FOREIGN KEY (uid) REFERENCES users (uid)
|
|
);
|
|
|