Add backup and deployment schema updates for improved data handling

- Introduced new SQL file `0089_noisy_sandman.sql` to create a new enum type `backupType` and add relevant columns to the `backup` and `deployment` tables, enhancing data structure for backup management.
- Removed outdated SQL files `0090_lame_gressill.sql` and `0091_colossal_lifeguard.sql` that contained redundant column definitions, streamlining the database schema.
- Updated journal and snapshot JSON files to reflect the latest schema changes, ensuring consistency across the database structure.
This commit is contained in:
Mauricio Siu
2025-05-04 15:13:49 -06:00
parent 9aa56870b0
commit e3ec8f1589
9 changed files with 76 additions and 11407 deletions

View File

@@ -144,14 +144,44 @@ export const initializeJobs = async () => {
const schedulesResult = await db.query.schedules.findMany({
where: eq(schedules.enabled, true),
with: {
application: {
with: {
server: true,
},
},
compose: {
with: {
server: true,
},
},
server: true,
},
});
for (const schedule of schedulesResult) {
const filteredSchedulesBasedOnServerStatus = schedulesResult.filter(
(schedule) => {
if (schedule.server) {
return schedule.server.serverStatus === "active";
}
if (schedule.application) {
return schedule.application.server?.serverStatus === "active";
}
if (schedule.compose) {
return schedule.compose.server?.serverStatus === "active";
}
},
);
for (const schedule of filteredSchedulesBasedOnServerStatus) {
scheduleJob({
scheduleId: schedule.scheduleId,
type: "schedule",
cronSchedule: schedule.cronExpression,
});
}
logger.info({ Quantity: schedulesResult.length }, "Schedules Initialized");
logger.info(
{ Quantity: filteredSchedulesBasedOnServerStatus.length },
"Schedules Initialized",
);
};

View File

@@ -7,7 +7,7 @@ import { runJobs } from "./utils.js";
export const firstWorker = new Worker(
"backupQueue",
async (job: Job<QueueJob>) => {
logger.info({ data: job.data }, "Job received");
logger.info({ data: job.data }, "Running job");
await runJobs(job.data);
},
{
@@ -18,7 +18,7 @@ export const firstWorker = new Worker(
export const secondWorker = new Worker(
"backupQueue",
async (job: Job<QueueJob>) => {
logger.info({ data: job.data }, "Job received");
logger.info({ data: job.data }, "Running job");
await runJobs(job.data);
},
{