feat: add global storage capacity limit

This commit is contained in:
Lan committed 2026-07-11 17:50:26 +08:00
1 parent 93ff291366
commit 818dd47b2a
12 files changed
+496 -95

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
from tortoise import connections
async def migrate():
conn = connections.get("default")
await conn.execute_script(
"""
CREATE TABLE IF NOT EXISTS storagereservation (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
token VARCHAR(64) NOT NULL UNIQUE,
size BIGINT NOT NULL,
expires_at TIMESTAMP NOT NULL
);
CREATE UNIQUE INDEX IF NOT EXISTS idx_storagereservation_token
ON storagereservation (token);
CREATE INDEX IF NOT EXISTS idx_storagereservation_expires_at
ON storagereservation (expires_at);
"""
)