feat: dedup downloads by (url, format_id) index, reuse existing files
This commit is contained in:
@@ -21,3 +21,9 @@ async def get_db():
|
||||
async def init_db():
|
||||
async with engine.begin() as conn:
|
||||
await conn.run_sync(Base.metadata.create_all)
|
||||
# Ensure composite index exists on already-created tables (idempotent)
|
||||
await conn.execute(
|
||||
__import__("sqlalchemy").text(
|
||||
"CREATE INDEX IF NOT EXISTS ix_video_url_format_id ON videos (url, format_id)"
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user