чанки в БД (таблица chunks), убран _chunk_store в памяти, v1.17

This commit is contained in:
2026-06-17 17:23:43 +04:00
parent 87026a1fd8
commit 0dac6bf37b
3 changed files with 81 additions and 47 deletions
+19
View File
@@ -98,6 +98,24 @@ CREATE TABLE IF NOT EXISTS spec_history (
);
"""
# ── Таблица chunks ─────────────────────────────────────────────
# Чанковая загрузка: части файла до сборки.
# upload_id связывает чанки одного файла.
DDL_CHUNKS = """
CREATE TABLE IF NOT EXISTS chunks (
upload_id TEXT NOT NULL,
chunk_index INTEGER NOT NULL,
chunk_data BYTEA NOT NULL,
filename TEXT,
mime TEXT,
total_chunks INTEGER,
cid TEXT,
created_at TIMESTAMPTZ DEFAULT now(),
PRIMARY KEY (upload_id, chunk_index)
);
"""
# ── Список всех DDL ────────────────────────────────────────────
ALL_DDL = [
@@ -106,6 +124,7 @@ ALL_DDL = [
("supplements", DDL_SUPPLEMENTS),
("spec_rows", DDL_SPEC_ROWS),
("spec_history", DDL_SPEC_HISTORY),
("chunks", DDL_CHUNKS),
]