fix(backups-schedule): missing null matching for last backup status
This commit is contained in:
parent
1e04c763f0
commit
17f2178e36
4 changed files with 17 additions and 4 deletions
|
|
@ -15,7 +15,11 @@ export const convertLegacyUserOnFirstLogin = async (ctx: AuthMiddlewareContext)
|
|||
|
||||
const legacyUser = await db.query.usersTable.findFirst({
|
||||
where: {
|
||||
AND: [{ username: body.username.trim().toLowerCase() }, { passwordHash: { NOT: "" } }],
|
||||
AND: [
|
||||
{ username: body.username.trim().toLowerCase() },
|
||||
{ passwordHash: { NOT: "" } },
|
||||
{ passwordHash: { isNotNull: true } },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -30,9 +30,14 @@ export const relations = defineRelations(schema, (r) => ({
|
|||
},
|
||||
backupSchedulesTable: {
|
||||
mirrors: r.many.repositoriesTable({
|
||||
from: r.backupSchedulesTable.id.through(r.backupScheduleMirrorsTable.scheduleId),
|
||||
to: r.repositoriesTable.id.through(r.backupScheduleMirrorsTable.repositoryId),
|
||||
alias: "repositoriesTable_id_backupSchedulesTable_id_via_backupScheduleMirrorsTable",
|
||||
}),
|
||||
notificationDestinationsTables: r.many.notificationDestinationsTable(),
|
||||
notificationDestinationsTables: r.many.notificationDestinationsTable({
|
||||
from: r.backupSchedulesTable.id.through(r.backupScheduleNotificationsTable.scheduleId),
|
||||
to: r.notificationDestinationsTable.id.through(r.backupScheduleNotificationsTable.destinationId),
|
||||
}),
|
||||
organization: r.one.organization({
|
||||
from: r.backupSchedulesTable.organizationId,
|
||||
to: r.organization.id,
|
||||
|
|
|
|||
|
|
@ -266,7 +266,7 @@ export const backupSchedulesTable = sqliteTable("backup_schedules_table", {
|
|||
excludeIfPresent: text("exclude_if_present", { mode: "json" }).$type<string[]>().default([]),
|
||||
includePatterns: text("include_patterns", { mode: "json" }).$type<string[]>().default([]),
|
||||
lastBackupAt: int("last_backup_at", { mode: "number" }),
|
||||
lastBackupStatus: text("last_backup_status").$type<"success" | "error" | "in_progress" | "warning">(),
|
||||
lastBackupStatus: text("last_backup_status").$type<"success" | "error" | "in_progress" | "warning" | null>(),
|
||||
lastBackupError: text("last_backup_error"),
|
||||
nextBackupAt: int("next_backup_at", { mode: "number" }),
|
||||
oneFileSystem: int("one_file_system", { mode: "boolean" }).notNull().default(false),
|
||||
|
|
|
|||
|
|
@ -441,7 +441,11 @@ const getSchedulesToExecute = async () => {
|
|||
const now = Date.now();
|
||||
const schedules = await db.query.backupSchedulesTable.findMany({
|
||||
where: {
|
||||
AND: [{ enabled: true }, { lastBackupStatus: { NOT: "in_progress" } }, { organizationId }],
|
||||
AND: [
|
||||
{ enabled: true },
|
||||
{ OR: [{ lastBackupStatus: { NOT: "in_progress" } }, { lastBackupStatus: { isNull: true } }] },
|
||||
{ organizationId },
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue