From cb995334d56b9c306b6313b63d6e02030c56932c Mon Sep 17 00:00:00 2001 From: Manuel Riel Date: Mon, 22 Apr 2019 15:41:22 +0800 Subject: [PATCH] Migrate archive table in chunks. Fixes #266 (#267) --- src/vorta/models.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/vorta/models.py b/src/vorta/models.py index 18353469..2d45b4a4 100644 --- a/src/vorta/models.py +++ b/src/vorta/models.py @@ -348,6 +348,8 @@ def init_db(con): ArchiveModel.time, ArchiveModel.duration, ArchiveModel.size] data = [row for row in cursor.fetchall()] with db.atomic(): - ArchiveModel.insert_many(data, fields=fields).execute() + size = 1000 + for i in range(0, len(data), size): + ArchiveModel.insert_many(data[i:i + size], fields=fields).execute() _apply_schema_update(current_schema, 13)