mirror of
https://github.com/Portabase/portabase.git
synced 2026-07-14 11:16:13 +02:00
feat: add agent healthcheck
This commit is contained in:
+3
-1
@@ -15,6 +15,7 @@ import * as notificationLog from "./schema/11_notification-log";
|
||||
import * as storageChannel from "./schema/12_storage-channel";
|
||||
import * as storagePolicy from "@/db/schema/13_storage-policy";
|
||||
import * as backupStorage from "@/db/schema/14_storage-backup";
|
||||
import * as healthcheckLog from "@/db/schema/15_healthcheck-log";
|
||||
|
||||
|
||||
import {Pool} from "pg";
|
||||
@@ -46,7 +47,8 @@ export const schemas = {
|
||||
...notificationLog,
|
||||
...storageChannel,
|
||||
...storagePolicy,
|
||||
...backupStorage
|
||||
...backupStorage,
|
||||
...healthcheckLog
|
||||
};
|
||||
|
||||
export const db = drizzle({
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
CREATE TYPE "public"."healthcheck_status" AS ENUM('success', 'failed');--> statement-breakpoint
|
||||
CREATE TYPE "public"."healthcheck_kind" AS ENUM('database', 'agent');--> statement-breakpoint
|
||||
CREATE TABLE "healthcheck_log" (
|
||||
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
|
||||
"kind" "healthcheck_kind" NOT NULL,
|
||||
"date" timestamp,
|
||||
"status" "healthcheck_status",
|
||||
"object_id" uuid,
|
||||
"updated_at" timestamp,
|
||||
"created_at" timestamp DEFAULT now() NOT NULL,
|
||||
"deleted_at" timestamp
|
||||
);
|
||||
@@ -0,0 +1,3 @@
|
||||
ALTER TABLE "healthcheck_log" ALTER COLUMN "date" SET NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "healthcheck_log" ALTER COLUMN "status" SET NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE "healthcheck_log" ALTER COLUMN "object_id" SET NOT NULL;
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -281,6 +281,20 @@
|
||||
"when": 1773659096498,
|
||||
"tag": "0039_conscious_solo",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 40,
|
||||
"version": "7",
|
||||
"when": 1774375027038,
|
||||
"tag": "0040_quick_lester",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 41,
|
||||
"version": "7",
|
||||
"when": 1774378412843,
|
||||
"tag": "0041_spooky_radioactive_man",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
import {pgTable, uuid, timestamp, pgEnum} from 'drizzle-orm/pg-core';
|
||||
import {timestamps} from "@/db/schema/00_common";
|
||||
import {createSelectSchema} from "drizzle-zod";
|
||||
import {z} from "zod";
|
||||
|
||||
export const healthcheckKindEnum = pgEnum('healthcheck_kind', ['database', 'agent']);
|
||||
export const healthCheckStatusEnum = pgEnum('healthcheck_status', ['success', 'failed']);
|
||||
|
||||
|
||||
export const healthcheckLog = pgTable('healthcheck_log', {
|
||||
id: uuid('id').defaultRandom().primaryKey(),
|
||||
kind: healthcheckKindEnum('kind').notNull(),
|
||||
date: timestamp("date").notNull(),
|
||||
status: healthCheckStatusEnum("status").notNull(),
|
||||
objectId: uuid('object_id').notNull(),
|
||||
...timestamps
|
||||
});
|
||||
|
||||
export const healthcheckLogSchema = createSelectSchema(healthcheckLog);
|
||||
export type HealthcheckLog = z.infer<typeof healthcheckLogSchema>;
|
||||
|
||||
export type HealthcheckKind = (typeof healthcheckKindEnum.enumValues)[number];
|
||||
export type HealthcheckStatus = (typeof healthCheckStatusEnum.enumValues)[number];
|
||||
Reference in New Issue
Block a user