Simple mini clone of torrra

This commit is contained in:
Alexander
2026-07-02 17:02:49 +02:00
commit 80ebf1cb63
24 changed files with 6424 additions and 0 deletions
+22
View File
@@ -0,0 +1,22 @@
CREATE TYPE torrent_state AS ENUM (
'pending',
'downloading',
'paused',
'finished',
'error'
);
CREATE TABLE torrents (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
info_hash TEXT NOT NULL UNIQUE,
name TEXT,
source TEXT NOT NULL,
output_path TEXT NOT NULL,
total_bytes BIGINT,
downloaded_bytes BIGINT NOT NULL DEFAULT 0,
state torrent_state NOT NULL DEFAULT 'pending',
error_message TEXT,
added_at TIMESTAMPTZ NOT NULL DEFAULT now(),
updated_at TIMESTAMPTZ NOT NULL DEFAULT now(),
completed_at TIMESTAMPTZ
);