Files
discord-storage/schema.sql
b3ni15 2f07f75088 feat: Implement file upload and management system
- Created database schema for files and file parts.
- Added API endpoint to create a new file and generate an upload token.
- Implemented API endpoint to complete file uploads and generate a download token.
- Developed cron job for cleaning up expired files and deleting associated Discord messages.
- Added API endpoint for soft deletion of files and their parts.
- Implemented API endpoint to fetch file metadata and parts for download.
- Created API endpoint to upload file parts to Discord.
- Developed a client-side download page to handle file decryption and assembly.
- Established database connection pooling for efficient database operations.
2025-10-16 09:16:06 +02:00

23 lines
648 B
SQL

CREATE TABLE files (
id CHAR(36) PRIMARY KEY, -- UUID
filename VARCHAR(512),
size BIGINT,
num_parts INT,
upload_at DATETIME,
expires_at DATETIME,
token_hash CHAR(64), -- pl. SHA256(token)
encrypted_key VARBINARY(512), -- opcionális: ha szerver old. titkosít egy kulcsot
deleted TINYINT(1) DEFAULT 0
);
CREATE TABLE file_parts (
id INT AUTO_INCREMENT PRIMARY KEY,
file_id CHAR(36),
part_index INT,
discord_message_id VARCHAR(64), -- üzenet id, vagy webhook meta
discord_attachment_url VARCHAR(1024),
size INT,
checksum CHAR(64),
FOREIGN KEY (file_id) REFERENCES files(id)
);