new schema version

This commit is contained in:
shivansh02 2024-05-11 21:58:08 +05:30
parent 90cf806b44
commit ec47d5ce1e
3 changed files with 12 additions and 6 deletions

View File

@ -18,6 +18,8 @@ from vorta.borg.compact import BorgCompactJob
from vorta.i18n import translate
from vorta.notifications import VortaNotifications
from vorta.store.models import BackupProfileModel, EventLogModel
from vorta.utils import borg_compat
logger = logging.getLogger(__name__)
@ -473,7 +475,6 @@ class VortaScheduler(QtCore.QObject):
job = BorgListRepoJob(msg['cmd'], msg, profile.repo.id)
self.app.jobs_manager.add_job(job)
# Check if a check job is needed
validation_cutoff = dt.now() - timedelta(days=7 * profile.validation_weeks)
recent_validations = (
EventLogModel.select()
@ -489,9 +490,8 @@ class VortaScheduler(QtCore.QObject):
if msg['ok']:
job = BorgCheckJob(msg['cmd'], msg, profile.repo.id)
self.app.jobs_manager.add_job(job)
# Check if a compact job is needed
compaction_cutoff = dt.now() - timedelta(days=7 * profile.compaction_weeks)
compaction_cutoff = dt.now() - timedelta(minutes=7 * profile.compaction_weeks)
recent_compactions = (
EventLogModel.select()
.where(
@ -501,7 +501,7 @@ class VortaScheduler(QtCore.QObject):
)
.count()
)
if profile.compaction_on and recent_compactions == 0:
msg = BorgCompactJob.prepare(profile)
if msg['ok']:

View File

@ -24,7 +24,7 @@ from .models import (
)
from .settings import get_misc_settings
SCHEMA_VERSION = 22
SCHEMA_VERSION = 23
@signals.post_save(sender=SettingsModel)

View File

@ -248,6 +248,12 @@ def run_migrations(current_schema, db_connection):
'name',
pw.CharField(default=''),
),
)
if current_schema.version < 23:
_apply_schema_update(
current_schema,
23,
migrator.add_column(
BackupProfileModel._meta.table_name,
'compaction_on',